标签:
package studyjava; public class maopao { public static void main(String[] args) { int[] a={3,6,2,8,54,1,34}; sort(a); for(int i=0;i<a.length;i++) { System.out.println(a[i]); } } static void sort(int[] a) { int length=a.length; int temp; int i,j; for(j=length-1;j<length;j--) { for(i=0;i<j;i++) { if(a[i]>a[i+1]) { temp=a[i+1]; a[i+1]=a[i]; a[i]=temp; } } } } }
标签:
原文地址:http://www.cnblogs.com/penghong2014/p/5461518.html