JDK排序:java.util.Arrays.sort(数组名); //JDK提供(升序)
/* * JDK自带排序 升序 */ public class Jdksort { public static void main(String[] args) { int nums[] = {78,23,56,12,89,90}; Arrays.sort(nums); // 从大到小 System.out.print(Arrays.toString(nums)); int snum[] = new int [nums.length]; // 从小到大 for (int i = 0,j = nums.length -1; i < nums.length; i++,j--) { snum[i] = nums[j]; } System.out.println(Arrays.toString(nums)); } }