"Magic Squares" assignment
I suspect that you should read the matrices from files only once and store them in a two-dimensional integer array. Once you have that, it is trivial to verify whether the squares are magic.

I had in mind something like this:

private static int[][] loadFile(File file) {
     // Do file I/O for loading the square
     return square;
}

private static int getRowMagic(int[][] square, int row) {
    int sum = 0;

    for (int column = 0; column &lt; square.length; ++column) {
        sum += square[row][column];
    }

    return sum;
}

private static int getColumnMagic(int[][] square, int column) {
    int sum = 0;

    for (int row = 0; row &lt; square.length; ++row) {
        sum += square[row][column];
    }

    return sum;
}

private static int getDescendingDiagonalMagic(int[][] square) {
    int sum = 0; 

    for (int i = 0; i &lt; square.length; ++i) {
        sum += square[i][i];
    }

    return sum;
}

private static getAscendingDiagonalIsMagic(int[][] square) {
    int sum = 0;

    for (int i = 0; i &lt; square.length; ++i) {
        sum += square[square.length - 1 - i][i];
    }

    return sum;
}

public static boolean isMagicSquare(int[][] square) {
    int sum = getRowMagic(square, 0);

    for (int i = 0; i &lt; square.length; ++i) {
        if (sum != getRowMagic(square, i) || sum != getColumnMagic(square, i)) {
            return false;
        }
    }

    return getAscendingDiagonalMagic(square) == sum &amp;&amp;
           getDescendingDiagonalMagic(square) == sum;
}


Hope that helps.