Strange output from an array
I'm getting some really funky output from a program that should print out a list of numbers, but instead I get this output:
Sum of rows: [I@3e25a5
Sum of columns: [I@19821f
Sumof diagonals: [I@addbf1
The array is a magic square
Sum of rows: [I@42e816
Sum of columns: [I@9304b1
Sumof diagonals: [I@190d11
The array is a magic square
Sum of rows: [I@a90653
Sum of columns: [I@de6ced
Sumof diagonals: [I@c17164
The array is a magic square
Here's my code:
publicclass MagicSquare
{
publicstaticvoid isMagic (int[][] b )
{
int numRow = b[0].length;
int numCol = b[1].length;
int[] rowSum =newint[b[0].length];
int[] colSum =newint[b[1].length];
int[] diaSum =newint[2];
for (int i = 0; i < numRow; i++ )
for (int j = 0; j < numCol; j++ )
{
int x = 0;
rowSum[x] = b[i][j];
colSum[x] = b[j][i];
if (i == j)
{
diaSum[x] = b[i][j];
}
x++;
}
System.out.println("Sum of rows: " + rowSum);
System.out.println("Sum of columns: " + colSum);
System.out.println("Sumof diagonals: " + diaSum);
if(true)
{
System.out.println("The array is a magic square");
}
else System.out.println("The array is not a magic square");
}
publicstaticvoid main(String[] args)
{
int[][] xArray ={{5, 9, 1},{3, 4, 8},{7, 2, 6}};
int[][] yArray ={{1, 3, 16, 14},{8, 15, 2, 9},
{13, 6, 11, 4},{12, 10, 5, 7}};
int[][] zArray ={{18, 24, 5, 6, 12},{10, 11, 17, 23, 4},
{22, 3, 9, 15, 16},{14, 20, 21, 2, 8},
{1, 7, 13, 19, 25}};
isMagic(xArray);
isMagic(yArray);
isMagic(zArray);
}
}
The if statement is set to true for debugging, but what I don't understand is why I'm getting that weird output, according to Eclipse I don't have any errors, and as far as I can tell, there shouldn't be anything wrong with it.

