@Test public void rotateNXNMatrix_1_6() { int[][] matrix = new int[][] { { 1, 2, 3, 4, 5, 6, }, {7, 8, 9, 10, 11, 12}, {13, 14, 15, 16, 17, 18}, {19, 20, 21, 22, 23, 24}, {25, 26, 27, 28, 29, 30}, {31, 32, 33, 34, 35, 36} }; int[][] matrixExpect = new int[][] { {31, 25, 19, 13, 7, 1}, {32, 26, 20, 14, 8, 2}, {33, 27, 21, 15, 9, 3}, {34, 28, 22, 16, 10, 4}, {35, 29, 23, 17, 11, 5}, {36, 30, 24, 18, 12, 6} }; int[][] matrixGot = Chapter1.rotateNXNMatrix_1_6(matrix, 6); for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { assertEquals(matrixExpect[i][j], matrixGot[i][j]); } } }