2. Apache Commons Math
import Jama.Matrix;
public class MatrixAdditionExample {
public static void main(String[] args) {
double[][] array1 = {{1, 2}, {3, 4}};
double[][] array2 = {{5, 6}, {7, 8}};
Matrix matrix1 = new Matrix(array1);
Matrix matrix2 = new Matrix(array2);
Matrix result = matrix1.plus(matrix2);
result.print();
}
}