Java Data Type Tutorial - Java UUID.nameUUIDFromBytes(byte[] name)








Syntax

UUID.nameUUIDFromBytes(byte[] name) has the following syntax.

public static UUID nameUUIDFromBytes(byte[] name)

Example

In the following code shows how to use UUID.nameUUIDFromBytes(byte[] name) method.

//from w w w  .  j av a2 s.  co m

import java.util.UUID;

public class Main {
   public static void main(String[] args) {
      byte[] nbyte = {10,20,30};
       
      // creating UUID from byte     
      UUID uid = UUID.nameUUIDFromBytes(nbyte);     
        
      // checking UUID value
      System.out.println("UUID value from byte: "+uid);    
   }     
}

The code above generates the following result.