Arrays.sort()函数原型 Arrays.sort(Array array, int fromIndex, int toIndex, Comparator comparator); public static void main(String[] args) { Integer[] a = new Integer[]{8, 3, 9, 7, 1}; Arrays.sort(a, 0, 3); for(int k: a) { System.out.print(k + “ ”); // 3 8 9 7 1 } }