Java UUID - node() Method
The java.util.UUID.node() method returns node value associated with this UUID. The node value is only meaningful in a time-based UUID, which has version type 1. If this UUID is not a time-based UUID then this method throws UnsupportedOperationException.
Syntax
public int node()
Parameters
No parameter is required.
Return Value
Returns the node value of this UUID.
Exception
Throws UnsupportedOperationException, if this UUID is not a version 1 UUID.
Example:
In the example below, the java.util.UUID.node() method returns the node value of the given UUID.
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 the node value of the uuid System.out.println("Node Value: " + uid.node()); } }
The output of the above code will be:
Node Value: 138509024481739
❮ Java.util - UUID