import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class SortTest {
public static void main(String[] args) {
int k,i,t1,t2,t3;
List<String > arrayList=new ArrayList<String >();
for(int n1=0;n1<10;n1++){
do{
k=(int) (Math.random()10);
}while(k<1);
String []str =new String[k];
for(int n=0;n<k;n++){
i=(int) (Math.random()3);
System.out.println("i="+i);
switch (i) {
case 0:
t1=(int) (Math.random()25+65);
str[n]=String.valueOf((char)t1);
break;
case 1:
t2=(int) (Math.random()25+97);
str[n]=String.valueOf((char)t2);
break;
case 2:
t3=(int) (Math.random()*10);
str[n]=String.valueOf(t3);
break;
}
}
String str1 = "";
for(int j=0;j<str.length;j++)
str1+=str[j];
//System.out.println(str1);
arrayList.add(str1);
}
System.out.println("---------------排序之前-------------");
for (String string : arrayList) {
System.out.println(string);
}
Collections.sort(arrayList);
System.out.println("---------------排序之后-------------");
for (String string : arrayList) {
System.out.println(string);
}
}
}