public class Test {
public static void main(String[] args) {
int[][] people = {{-2147483646, -2147483645}, {2147483646, 2147483647}, {5, 0}, {7, 1}, {7, 0}, {6, 1}};
Arrays.sort(people, (a, b) -> Integer.compare(a[0], b[0]));
for (int i = 0; i < people.length; i++) {
System.out.println(Arrays.toString(people[i]));
}
}
}
【Java二维数组排序】只考虑第一个数 带负数
最新推荐文章于 2023-11-07 01:02:44 发布