package math; public class Matrix { public static int[][] add(int[][] a, int[][] b) { int numRows = a.length; int numCols = a[0].length; int[][] c = new int[numRows][]; for (int i = 0; i < numRows; i++) { c[i] = new int[numCols]; } for (int row = 0; row < numRows; row++) { for (int col = 0; col < numCols; col++) { c[row][col] = a[row][col] + b[row][col]; } } return c; } }