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

StringgenerateId()
Generates and returns unique identifier.
return UUID.randomUUID().toString();
MapgenerateRandomMap(int count)
Generates random map.
Map<String, String> randomData = new HashMap<String, String>();
for (int i = 0; i < count; i++) {
    String randomKey = randomAlphanumeric(generateRandomNumber(16, 32));
    String randomValue = randomAlphanumeric(generateRandomNumber(16, 32));
    randomData.put(randomKey, randomValue);
return randomData;
StringgenerateRandomName()
Generates random name that consists of letters, numbers and underscores
return UUID.randomUUID().toString();
StringGenerateRandomSlug()

Generates a pseudo random 32 character string

UUID uniqueSlug = UUID.randomUUID();
return uniqueSlug.toString().replace("-", "");
StringgenerateRandomString(int length)
Generates a random string of length characters.
String randomString = "";
while (true) {
    if (randomString.length() >= length)
        return randomString.substring(0, length - 1);
    else
        randomString += java.util.UUID.randomUUID().toString().replaceAll("-", "");
StringgenerateRandomTableName()
generate Random Table Name
String tableName = "table" + UUID.randomUUID().toString().toLowerCase();
return tableName.replace("-", "");
StringgenerateRandomUUID()
generate Random UUID
long id1 = System.currentTimeMillis() & 0x3FFFFFFFL;
long id3 = randomLong(-0x80000000L, 0x80000000L) & 0x3FFFFFFFL;
return __convert(id1, 6, __chars64) + __convert(id3, 6, __chars64).replaceAll(" ", "o");
StringgenerateRandomUUID(final int length)
generate Random UUID
UUID uuid = UUID.randomUUID();
char[] uuidChars = uuid.toString().toCharArray();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < length; i++) {
    builder.append(uuidChars[i]);
return builder.toString();
StringgenerateRawUUID()
Generate a raw identifier used in PLUS object IDs
UUID u = UUID.randomUUID();
return u.toString();
StringgenerateRequestId()
Returns a random 32 character request id
String uuid = UUID.randomUUID().toString();
String requestId = uuid.replace("-", "");
return requestId;