冒泡排序
public class maopaipaixu { public static void main(String[] args) { int [] num ={1,7,2,5,9,4,2,11,10,3}; int[] sort = sort(num); System.out.println(Arrays.toString(sort)); } private static int[] sort(int[] num) { for (int i = 0; i < num.length - 1; i++) { for (int j = 0; j < num.length - 1 - i; j++) { if (num[j] > num[j+1]) { int temp = num[j]; num[j]=num[j+1]; num[j+1]=temp; } } } return num; } }