public void magicSquare4Odd(int n){
		int a[][]=new int[n][n];
		for(int i=0;i<n;i++){
			for (int j = 0; j < n; j++) {
				a[i][j] = 0;
			}
		}
		int mid = n/2+1; 
		
		int max = n*n;
		int cur_row = 0;
		int cur_col = n/2;
		int pre_row = 0;
		int pre_col = 0;
		a[cur_row][cur_col]=1;
		for (int i = 2; i <= max; i++) {
			//浱ǰ
			pre_row = cur_row;
			pre_col = cur_col;
			
			// 45㷽ߣ,ÿһŵбǰһ11
			cur_row--;
			cur_col++;
			
			//ǷԽ
			if (0 > cur_row) {
				cur_row = n - 1;
			}else if (n-1 <cur_row) {
				cur_row = 0;
			}
			if (0 > cur_col) {
				cur_col = n - 1;
			}else if (n-1 <cur_col) {
				cur_col = 0;
			}
			
			//ǰֵǵһеnʱ
			if (0 != a[cur_row][cur_col] || (0 == pre_row && n-1 == pre_col)) {
				cur_row = pre_row+1;
				cur_col = pre_col;
			}
			
			a[cur_row][cur_col]=i;
		}
		//ӡ
		for(int i=0;i<n;i++){
			for (int j = 0; j < n; j++) {
				System.out.printf("%5d ",a[i][j]);
			}
			System.out.println("");
		}
	}