Here you can find the source of getUUID()
public static String getUUID()
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static String getUUID() { UUID uuid = UUID.randomUUID(); return (digits(uuid.getMostSignificantBits() >> 32, 8) + digits(uuid.getMostSignificantBits() >> 16, 4) + digits(uuid.getMostSignificantBits(), 4) + digits(uuid.getLeastSignificantBits() >> 48, 4) + digits(uuid.getLeastSignificantBits(), 12)); }/*w w w . ja va 2 s. c om*/ private static String digits(long val, int digits) { long hi = 1L << (digits * 4); return Long.toHexString(hi | (val & (hi - 1))).substring(1).toLowerCase(); } public static String substring(String str, int start, int count) { return str.substring(start, start + count); } }