getRandom(2)生成2位随机字符串
public static String getRandom(int strLength) {
Random rand = new Random(new Date().getTime());
int cnt = 26 * 2 + 10;
char[] s = new char[strLength];
for (int i = 0; i < strLength; i++) {
int v = rand.nextInt(cnt);
if (v < 10)
s[i] = (char) ('0' + v);
else if (v < 36)
s[i] = (char) (v - 10 + 'A');
else
s[i] = (char) (v - 36 + 'a');
}
return new String(s);
}