按身高排列

    科技2024-12-30  35

    int[][] a = {{7,0}, {4,4}, {7,1}, {5,0}, {6,1}, {5,2}}; Arrays.sort(a,(o1,o2)->o1[0] == o2[0] ? o1[1] - o2[1] : o2[0] - o1[0]); List<int[]> list = new LinkedList<>(); for(int[] p:a){ list.add(p[1],p); } System.out.println(list); System.out.println(list.toArray(new int[a.length][2]));
    Processed: 0.009, SQL: 8