I am trying to generate a UUID to a string, so that when I enter uuidcreaterandom, it will create a random UUID. I have pasted below what I tried, and am I missing something ? Any pointers much appreciated. Thank you..
public UUID uuidCreateRandom() {
    return UUID.randomUUID();
}
public UUID uuidCreateFromHexString(String uuid) {
    return UUID.fromString(uuid);
}
public String uuidCreateRandom(UUID uuid) {
    return uuid.toString();
}
public int uuidGetVersion(UUID uuid) {
    return uuid.version();
}
public UUID get_uuid() {
    return _uuid;
}
public String get_uuidString() {
    return _uuidString;
}
public int get_uuidVersion() {
    return _uuidVersion;
}
public void set_uuid() {
    _uuid = UUID.randomUUID();
}
public void set_uuidString(UUID uuid) {
    _uuidString = uuid.toString();
}
public void set_uuidVersion(UUID uuid) {
    _uuidVersion = uuid.version();
}
                It's not super clear what you're asking but the following code will generate a random UUID and get the string representation and version:
Scanner scanner = new Scanner(System.in);
while (true) {
   String line = scanner.nextLine().trim();
   if (line.equals("uuidcreaterandom")) {
      UUID uuid = UUID.randomUUID();
      String str = uuid.toString();
      System.out.println(str);
   }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With