标签:
int[]array ={49,38,65,97,76,13,27,19}; for(int i=0;i<array.length-1;i++){ System.out.print(array[i]+"\t"); } System.out.println( ); for(int j=1;j<array.length-1;j++){ for(int i=0;i<array.length-j;i++){ if(array[i]>array[i+1]){ int r =array[i]; array[i]=array[i+1]; array[i+1]=r; } } for(int i=0;i<array.length;i++){ System.out.print(array[i]+"\t"); } System.out.println( );}
运行结果:
标签:
原文地址:http://www.cnblogs.com/0927wyj/p/5027439.html