public static void rotates(int[][] matrix) {
		int n = matrix.length;

		for (int i = 0; i < n / 2; ++i)
			for (int j = i; j < n - 1 - i; ++j) {
				// top
				int t = matrix[i][j];
				// top,
				matrix[i][j] = matrix[n - 1 - j][i];
				matrix[n - 1 - j][i] = matrix[n - 1 - i][n - 1 - j];
				matrix[n - 1 - i][n - 1 - j] = matrix[j][n - 1 - i];
				matrix[j][n - 1 - i] = t;
			}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				System.out.print(matrix[i][j] + " ");
			}
			System.out.println();
		}
	}