SyntaxFix
Write A Post
Hire A Developer
Questions
To sort in descending order you can flip the two parameters
int[][] array= { {1, 5}, {13, 1}, {12, 100}, {12, 85} }; Arrays.sort(array, (b, a) -> Integer.compare(a[0], b[0]));
Output:
13, 5 12, 100 12, 85 1, 5