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()
generate Uuid
UUID uuid = UUID.randomUUID();
StringBuffer idcUuid = new StringBuffer(uuid.toString().toUpperCase());
while (idcUuid.length() < 36) {
    idcUuid.append("0");
return idcUuid.toString();
UUIDgenerateUUID()
generate UUID
UUID result = UUID.randomUUID();
char[] chars = result.toString().toCharArray();
if (chars[0] >= 'a' && chars[0] <= 'z') {
    return result;
} else {
    Random r = new Random();
    chars[0] = hexa.charAt(r.nextInt(hexan));
    result = UUID.fromString(new String(chars));
...
StringgenerateUUID()
generate UUID
char[] uuid = new char[32];
char[] chars = UUID.randomUUID().toString().toCharArray();
for (int i = 0, j = 0; i < 32; j++)
    if (chars[j] != '-')
        uuid[i++] = chars[j];
return new String(uuid);
StringgenerateUUID()
Generate UUID.
String random = UUID.randomUUID().toString();
random = random.replace("/", "_");
random = random.replace("=", "a");
random = random.replace("+", "f");
return random;
StringgenerateUUID()
generate UUID
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 8; i++) {
    sb.append(UUID.randomUUID().toString().split("-")[0]);
    sb.append(UUID.randomUUID().toString().split("-")[1]);
    sb.append(UUID.randomUUID().toString().split("-")[2]);
    sb.append(UUID.randomUUID().toString().split("-")[3]);
    sb.append(UUID.randomUUID().toString().split("-")[4]);
return sb.toString();
StringgenerateUUID()
Generate Samsung uuid.
String uuid_prefix = "4a682b0b-0361-dbae-6155";
String uuid = String.valueOf(UUID.randomUUID());
String uuid_suffix = uuid.substring(uuid.lastIndexOf("-"));
return uuid_prefix + uuid_suffix;
StringgenerateUUID()
generate UUID
UUID uuid = UUID.randomUUID();
return uuid.toString();
StringgenerateUuid(boolean dash)
Generate UUID
String uuid = UUID.randomUUID().toString();
if (dash) {
    return uuid;
return uuid.replaceAll("-", "");
StringgenerateUUID(int numchars)
Generated a random UUID with the specified number of characters.
Random r = new Random();
StringBuilder sb = new StringBuilder(numchars);
for (int i = 0; i < numchars; i++) {
    int c = r.nextInt(36) + 97;
    if (c > 'z')
        c -= ('z' - '0' + 1);
    sb.append((char) c);
return sb.toString();
StringgenerateUUID(Object o)
generate UUID
StringBuffer tmpBuffer = new StringBuffer(16);
if (hexServerIP_ == null) {
    InetAddress localInetAddress = null;
    try {
        localInetAddress = InetAddress.getLocalHost();
    } catch (java.net.UnknownHostException uhe) {
        uhe.printStackTrace();
        return null;
...