标签:
public class ShengXu { public static void main(String []args){ int e[]=new int[]{2,1,4,9,3};//实例化数组 for(int i=0;i<e.length-1;i++){ for(int j=0;j<e.length-i-1;j++){ int num=0; if(e[j]>e[j+1]){ num=e[j]; e[j]=e[j+1]; e[j+1]=num; } } } for(int s:e){ System.out.print(s+" "); } } }
1 2 3 4 9
标签:
原文地址:http://www.cnblogs.com/tianwei0/p/5657283.html