int[][] twoDim = { { 1, 2 }, { 3, 7 }, { 8, 9 }, { 4, 2 }, { 5, 3 } }; Arrays.sort(twoDim, (int[] o1, int[] o2) -> o2[0] - o1[0]); System.out.println(Arrays.deepToString(twoDim));