标签:dem demo stat oid public void rand ati system
public class ArrayDemo {
public static void main(String[] args) {
int array[] =new int[10];
int tmp;
for (int i = 0; i <10 ; i++) {
array[i]=(int)(Math.random()*100);
System.out.println(array[i]+"、");
}
System.out.println();
for (int a = 0; a <10 ; a++) {
for (int j = 0; j <a ; j++) {
if(array[j]>array[j+1]){
tmp=array[j];
array[j]=array[j+1];
array[j+1]=tmp;
}
}
}
for (int i = 0; i <10 ; i++) {
System.out.println(array[i]+" ");
}
}
结果:
6
10
17
33
48
53
77
81
15
96
标签:dem demo stat oid public void rand ati system
原文地址:https://www.cnblogs.com/1994xlai/p/13019955.html