The nameUUIDFromBytes() method of UUID class in Java is generally used to retrieve a third type name based UUID based on the specified byte array. This is used as a static factory method.
public static UUID nameUUIDFromBytes(byte byte_name)
Parameters: This method accepts a parameter byte_name which refers to the byte array that is used to construct a UUID.
Return Value: This method returns an UUID instance generated from a specified array.
Below programs illustrate the working of nameUUIDFromBytes() method:
Specified byte array: [50, 40, 30, 20, 10] UUID value from byte: d66541c4-a9db-3308-8c67-bbf87dc0df8b
Specified byte array: [10, 15, 1, 45, 13, 20, 71] UUID value from byte: 15fe1179-e857-306b-ad67-b2388e006c8a
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.