List of utility methods to do ID Value Create
String | createID() Generates a unique Id for Authentication Requests byte[] bytes = new byte[20]; new Random().nextBytes(bytes); char[] charMapping = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p' }; char[] chars = new char[40]; for (int i = 0; i < bytes.length; i++) { int left = (bytes[i] >> 4) & 0x0f; int right = bytes[i] & 0x0f; chars[i * 2] = charMapping[left]; ... |
String | createID() Create a randomly generated string conforming to the xsd:ID datatype. byte[] bytes = new byte[20]; random.nextBytes(bytes); char[] chars = new char[40]; for (int i = 0; i < bytes.length; i++) { int left = (bytes[i] >> 4) & 0x0f; int right = bytes[i] & 0x0f; chars[i * 2] = charMapping[left]; chars[i * 2 + 1] = charMapping[right]; ... |
String | generateId() generate Id long seed1 = System.currentTimeMillis(); while (seed1 == seed) seed1 = System.currentTimeMillis(); seed = seed1; Random r = new Random(seed); return Integer.toString(r.nextInt(), 16) + "-" + Integer.toString(r.nextInt(65535), 16) + "-" + Integer.toString(r.nextInt(65535), 16) + "-" + Integer.toString(r.nextInt(65535), 16); |
int | generateId() Generates a random, valid id to use when fetching a fact. Random rand = new Random(); int id = rand.nextInt(989) + 1; while (id > 497 && id < 651) { id = rand.nextInt(989) + 1; return id; |
String | generateId() generate Id int id = 1000000 + rng.nextInt(8999999); String sid = String.valueOf(id); return ("id" + sid); |
byte[] | generateId() generate Id byte[] id = new byte[RANDOM_ID_LENGTH]; new Random().nextBytes(id); return id; |
String | generateID(final String message) Generates a sensor id from description and current time as long. final long autoGeneratredID = new DateTime().getMillis(); final String concate = message + Long.toString(autoGeneratredID); return bytesToHex(messageDigest.digest(concate.getBytes())); |
int | generateID(int seed) generate ID Random rand = new Random(seed); int id = rand.nextInt(); if (id > 0) { id = -id; return id; |
String | generateID(String origin) generate ID java.security.MessageDigest md; String pwd = null; try { md = MessageDigest.getInstance("MD5"); byte[] b = origin.getBytes("UTF-8"); byte[] hash = md.digest(b); String str = byteArrayToHexString(hash); return str; ... |
String | generateId(String salt) generate Id return generateId(salt, "MD5"); |