public String generateRandomId(){ String chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ"; StringBuffer buffer = new StringBuffer(); for (int i = 0; i < 16; i++) { buffer.append(chars.charAt(new Random().nextInt(chars.length()))); } buffer.insert(0, "TR"); return buffer.toString(); }