Here you can find the source of getRandomId()
public static String getRandomId()
//package com.java2s; import java.util.Random; public class Main { private static Random rm = new Random(); private static String chartable[] = { "a", "A", "b", "B", "c", "C", "D", "d", "E", "e", "F", "f", "G", "g", "H", "h", "J", "j", "K", "k", "L", "M", "m", "N", "n", "P", "p", "Q", "R", "T", "t", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; public static String getRandomId() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 6; i++) { sb.append(chartable[getRandomIntNum(chartable.length)]); }/*from w ww . j a v a2s . c o m*/ return sb.toString(); } private static int getRandomIntNum(int limit) { return rm.nextInt(limit); } }