1// Import Java UUID Utils
2import java.utils.UUID;
3
4// Execute function fromString() with your string as argument.
5// Returns an uuid, which is your string converted into an UUID.
6UUID uuid = UUID.fromString(string);
1import java.util.UUID;
2
3public class RandomStringUUID {
4 public static void main(String[] args) {
5 // Creating a random UUID (Universally unique identifier).
6 UUID uuid = UUID.randomUUID();
7 String randomUUIDString = uuid.toString();
8
9 System.out.println("Random UUID String = " + randomUUIDString);
10 System.out.println("UUID version = " + uuid.version());
11 System.out.println("UUID variant = " + uuid.variant());
12 }
13}
14