Here is one way to do this with SimpleMatrix, but I have not tested the code:
double[] x = { 2.5, 0.5, 2.2, 1.9, 3.1, 2.3, 2.0, 1.0, 1.5, 1.1 }; double[] y = { 2.4, 0.7, 2.9, 2.2, 3.0, 2.7, 1.6, 1.1, 1.6, 0.9 }; SimpleMatrix a = new SimpleMatrix(x.length,1,true,x); SimpleMatrix b = new SimpleMatrix(x.length,1,true,x); double meanA = a.elementSum()/x.length; double meanB = a.elementSum()/y.length;
source share