public void testSort3(){
String string="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXZ";
Random random = new Random();
List<String> stringList = new ArrayList<String>();
for(int i=0;i<10;i++){
StringBuffer st = new StringBuffer();
do{
int num = random.nextInt(9)+1;
for(int j=0;j<num;j++){
int where = random.nextInt(62);
st.append(string.charAt(where));
}
}while(stringList.contains(st));
String st1 = st.toString();
stringList.add(st1);
}
System.out.println("-------------排序前----------------");
for(String string1:stringList){
System.out.println("元素"+string1);
}
Collections.sort(stringList);
System.out.println("--------------排序后-----------------");
for(String string1:stringList){
System.out.println("元素"+string1);
}
}
热门评论
int where = random.nextInt(62);
62是什么意思啊
st.append(string.charAt(where));
这句话是什么意思啊..求解