Java UUID.getLeastSignificantBits() method example

In this tutorial, You will learn how to get the least significant bits of this UUID. Java UUID.getLeastSignificantBits() method returns a least significant 64 bits of this UUID's 128 bit value.

Returns the least significant 64 bits of this UUID's 128 bit value.

syntax

public long getLeastSignificantBits()

Returns

The least significant 64 bits of this UUID's 128 bit value.

Java UUID getLeastSignificantBits() example

  • Initialize the String String name = "d605a917-a9d4-44d1-a3ef-60e960a4b9b2";
  • UUID.fromString(name); It creates a UUID from the string standard representation.
  • uuid.getLeastSignificantBits(); It returns the least significant 64 bits of this UUID's.
package com.technicalkeeda;

import java.util.UUID;

public class App {

    public static void main(String[] args) {

        String name = "d605a917-a9d4-44d1-a3ef-60e960a4b9b2";
        UUID uuid = UUID.fromString(name);

        System.out.println("Least significant bits of UUID is :- " + uuid.getLeastSignificantBits());
    }
}

output

Least significant bits of UUID is :- -6633977170628396622