标签:
import java.util.Arrays;
import java.util.Random;
public class SortSequence{
public static void main(String[] args){
Random rd=new Random(); //利用随机数随意产生15个0~20之间的随机数
int[] array=new int[15];
System.out.println("original number group:");
for(int i=0;i<array.length;i++){
array[i]=rd.nextInt(20);
System.out.print(" "+array[i]);
if((i+1)%5==0)
System.out.println();
}
Arrays.sort(array);
System.out.println("sorted:");
for(int i=0;i<array.length;i++)
{
System.out.print(" "+array[i]);
if((i+1)%5==0)
System.out.println();
}
}
}
标签:
原文地址:http://www.cnblogs.com/sunshinewxz/p/4525250.html