MagicSquare Implementation in java