Java Utililty Methods UUID Create

List of utility methods to do UUID Create

Description

The list of methods to do UUID Create are organized into topic(s).

Method

StringgenerateUniqueString()
generate Unique String
String uniqueKey = UUID.randomUUID().toString();
return uniqueKey.replaceAll("-", "");
StringgenerateUniqueText()
This method generates a unique string based on the current system date/time.
Date date = new Date();
SimpleDateFormat UNIQUE_DATE_TIME_STRING_FORMAT = new SimpleDateFormat("yyyyMMddHHmmSS");
String dateTimeString = UNIQUE_DATE_TIME_STRING_FORMAT.format(date);
return dateTimeString;
StringgenerateUri()
generate Uri
return PREFIX + UUID.randomUUID().toString();
StringgenerateURN()
Generates the URN string of "urn:st" namespace
return "urn:st:" + UUID.randomUUID().toString();
StringgenerateUUID()

UUID generator random

return UUID.randomUUID().getLeastSignificantBits() + "";
StringgenerateUUID()
generate UUID
new UUID(new Random().nextLong(), new Random().nextLong());
UUID generatedUUID = UUID.randomUUID();
return generatedUUID.toString();
StringgenerateUUID()
generate UUID
return createSimpleDateFormat().format(new Date()) + "-" + new Random().nextInt(10000);
StringgenerateUUID()
Generates a random UUID used as a RequestID for SAML request.
UUID uuid = UUID.randomUUID();
String strUUID = "a" + uuid.toString(); 
return strUUID;
StringgenerateUUID()
This method generates a unique ID (UUID - Universally unique identifier)
UUID uuid = UUID.randomUUID();
return uuid.toString();
StringgenerateUUID()
Returns a string of 16 HEX chars.
UUID uuid = UUID.randomUUID();
return Long.toHexString(uuid.getMostSignificantBits());