Here you can find the source of getKey(Object obj)
public static String getKey(Object obj)
//package com.java2s; //License from project: Apache License import java.security.SecureRandom; import java.util.Date; public class Main { private static SecureRandom seederStatic = null; private static String midValueStatic = null; public static String getKey(Object obj) { StringBuffer uid = new StringBuffer(32); // get the system time long currentTimeMillis = System.currentTimeMillis(); uid.append(toHex((int) (currentTimeMillis & -1L), 8)); // get the internet address uid.append(midValueStatic);// w w w. j ava 2 s .c o m // get the object hash value uid.append(toHex(System.identityHashCode(new Date()), 8)); // get the random number uid.append(toHex(getRandom(), 8)); return uid.toString(); } public static String getKey() { StringBuffer uid = new StringBuffer(32); // get the system time long currentTimeMillis = System.currentTimeMillis(); uid.append(toHex((int) (currentTimeMillis & -1L), 8)); // get the internet address uid.append(midValueStatic); // get the random number uid.append(toHex(getRandom(), 8)); return uid.toString(); } private static String toHex(int value, int length) { char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; StringBuffer buffer = new StringBuffer(length); int shift = length - 1 << 2; for (int i = -1; ++i < length;) { buffer.append(hexDigits[value >> shift & 0xf]); value <<= 4; } return buffer.toString(); } private static synchronized int getRandom() { return seederStatic.nextInt(); } }