Java UUID - getMostSignificantBits() Method
The java.util.UUID.getMostSignificantBits() method returns the most significant 64 bits of this UUID's 128 bit value.
Syntax
public long getMostSignificantBits()
Parameters
No parameter is required.
Return Value
Returns the most significant 64 bits of this UUID's 128 bit value.
Exception
NA.
Example:
In the example below, the java.util.UUID.getMostSignificantBits() method returns the most significant 64 bits of the given UUID's 128 bit value.
import java.util.*; public class MyClass { public static void main(String[] args) { //creating an UUID UUID uid = UUID.fromString("d81e4f2e-cdf2-10e6-529b-7df92533d1cb"); //printing most significant bits System.out.println("Most Significant bits: " + uid.getMostSignificantBits()); } }
The output of the above code will be:
Most Significant bits: -2873772449773514522
❮ Java.util - UUID