1.
Write a method public static int max(int[][] a)
that returns the maximum value in the 2d parameter array a.
2. Write a method public static int rowSum(int[][] a, int x)
that returns the sum of the elements in Row x of a.
3. Write a method public static int columnSum(int[][] a, int x)
that returns the sum of the elements in Column x of a.
4. Write a method public static int[] allRowSums(int[][] a)
that calculates the row sum for every row and returns each of the values in an array. Index i of the
return array contains the sum of elements in row i. You should assume that rowSum is working as
intended.
5. Write a method public static boolean isRowMagic(int[][] a)
that checks if the array is row-magic (this means that every row has the same row sum). You should
assume that allRowSums is working as intended.
6. Write a method public static boolean isColumnMagic(int[][] a)
that checks if the array is column-magic (this means that every column has the same column sum).
You should assume that columnSum is working as intended.
7. Write a method public static boolean isSquare(int[][] a)
that checks if the array is square (i.e. number of cols is the same as the number of rows).
8. Write a method public static boolean isMagic(int[][] a)
that checks if the array is a magic square. This means that it must be square, and that all row sums,
all column sums, and the two diagonal-sums must all be equal. You should assume that all
methods that you can use to help you are working as intended.