Java UUID.variant()

Syntax

UUID.variant() has the following syntax.

public int variant()

Example

In the following code shows how to use UUID.variant() method.


/*from   w  w w  .ja va 2  s .  c  o  m*/

import java.util.UUID;

public class Main {
   public static void main(String[] args) {
      // creating UUID      
      UUID uid = UUID.randomUUID();     
        
      // checking variant value
      System.out.println("Variant value: "+uid.variant());    
   }    
}

The code above generates the following result.