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

StringgenerateUUID(String prefix)
generate UUID
return UUID.randomUUID().toString();
UUIDgenerateUuid(String seed)
Generates a GUID using a seed.
try {
    return UUID.nameUUIDFromBytes(seed.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
    throw new RuntimeException(String.format("UnsupportedEncodingException: %f", e.getMessage()));
StringgenerateUUIDFileName(String fileName)
generate UUID File Name
UUID uuid = UUID.randomUUID();
String str = fileName;
System.out.println(str);
str = uuid.toString() + "." + str.substring(str.lastIndexOf(".") + 1);
return str;
UUIDgenerateUUIDFrom(String uuidString)
generate UUID From
StringBuilder uuidFromString = new StringBuilder(uuidString);
uuidFromString.insert(8, DELIMITER);
uuidFromString.insert(13, DELIMITER);
uuidFromString.insert(18, DELIMITER);
uuidFromString.insert(23, DELIMITER);
return UUID.fromString(uuidFromString.toString().toLowerCase());
UUIDgenerateUUIDFromString(String uuid)
generate UUID From String
return UUID.fromString(uuid);
StringgenerateUUIDName(String filename)
generate UUID Name
String ext = filename.substring(filename.indexOf(".") + 1);
return UUID.randomUUID().toString() + "." + ext;
StringgenerateUUIDRandom()
generate UUID Random
String uuid = UUID.randomUUID().toString();
uuid += "-" + generateShortRandom();
return uuid;
StringgenerateUuidStringStatic()
generate Uuid String Static
while (true) {
    String uuid = UUID_BASE + Long.toHexString(System.currentTimeMillis());
    if (!uuid.equals(previousUuid)) {
        previousUuid = uuid;
        return uuid;
    try {
        Thread.sleep(1);
...
StringgeneratorToken()
generator Token
UUID uuid = UUID.randomUUID();
String token = uuid.toString();
token = token.toUpperCase();
token = token.replaceAll("-", "");
return token;
StringgeneratorTransactionPath(String namespace)
generator Transaction Path
StringBuilder builder = new StringBuilder();
builder.append("/").append(namespace).append("/").append(generateStringUuid());
return builder.toString();