package test3; public class 冒泡排序 { public static void main(String[] args) { // TODO Auto-generated method stub int []a=new int [10]; System.out.println("随机数组的数据为:"); for(int m=0;m<10;m++){ //int random= a[m]=(int)(Math.random()*100); System.out.print(a[m]+"\t"); } System.out.println(); System.out.println("冒泡排序过程:"); for(int i=0;i for(int j=i+1;j if(a[i]>a[j]){ int k=a[i]; a[i]=a[j]; a[j]=k; } System.out.print(a[i]+"\t"); } System.out.println(); } System.out.println("排序后的结果是:"); for(int z:a){ System.out.print(z+"\t"); } } }