标签:style blog ar color sp for java div log
public class BubbleSort { public static void main(String[] args) { int[] a = {1,9,6,5,8,3,6,2,5,4}; bubbleSort(a); print(a); } private static void bubbleSort(int[] a) { int tmp; for(int i=a.length-1; i>1; i--) { for(int j=0; j<i; j++) { if(a[j] < a[j+1]) { tmp = a[j]; a[j] = a[j+1]; a[j+1] = tmp; } } } } private static void print(int[] a) { for(int i=0; i<a.length; i++) { System.out.print(a[i] + " "); } System.out.println(); } }
标签:style blog ar color sp for java div log
原文地址:http://www.cnblogs.com/qql1986/p/4152630.html