Sorting a 2d array by values in more than one column
问题 I want to build a method in Java for sorting an array according to values in more than a given column. Let me explain that with an example (matrix array): int matrix[][] = { {0,2,432},{1,1,282},{2,2,456},{3,4,191},{4,5,293}, {5,2,475},{6,2,491},{7,5,171},{8,5,134},{9,3,354}}; I need to sort every triplet according to the second position in decreasing order. After that, I need to sort the triplet in increasing order according to the third position. The code that I'm using for that is: import