手记

随机字符串生产并排序

//生成一串随机字符
public String scString() {
String sc = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
StringBuilder str = new StringBuilder();
int s = (int)(Math.random()10);
for(int i = 0;i < s;i++) {
int k = (int)(Math.random()
58);
//char z =sc.charAt(k);
str.append(sc.charAt(k));
}
String stz = str.toString();
System.out.println(stz);
return stz;
}

0人推荐
随时随地看视频
慕课网APP