static void print_matrix_clockwise(int[][] A, int offset) {
	  if (offset == A.length - offset - 1) {  // for matrix with odd size.
		  System.out.print(A[offset][offset]);
	  }

	  for (int j = offset; j < A.length - offset - 1; ++j) {
	    System.out.print(A[offset][j] + " ");
	  }
	  for (int i = offset; i < A.length - offset - 1; ++i) {
	    System.out.print(A[i][A.length - offset - 1] + " ");
	  }
	  for (int j = A.length - offset - 1; j > offset; --j) {
	    System.out.print(A[A.length - offset - 1][j] + " ");
	  }
	  for (int i = A.length - offset - 1; i > offset; --i) {
	    System.out.print(A[i][offset] + " ");
	  }
	}