冒泡排序,java面试题回顾
package com.java.test;/** * * @author Zhou Jingxian * */public class BubbleSort {public int[] testBubbleSort(int array[]){int i,j;int len = array.length;for(i = len-1; i>0; i--){for(j = 0; j<i; j++){if(array[j] > array[j+1]){int temp = array[j];array[j] = array[j+1];array[j+1] = temp;}}}for(i = 0; i<len; i++){System.out.print(array[i]+"\t");}return array;}public static void main(String args[]){new BubbleSort().testBubbleSort(new int[]{10,5,45,20,88,31});}}?最近面试,遇到了比较老的冒泡排序,写一个测试,回顾下