public class MeanVariance { public static void main (String[] args) { int len = args.length; double[] data = new double[len]; double mean, sum = 0, sum2 = 0, var; for (int i = 0; i < len; i++) { data[i] = Double.parseDouble(args[i]); } for (int i = 0; i < len; i++) { sum += data[i]; } mean = sum / len; System.out.println(mean); for (int i = 0; i < len; i++) { sum2 += Math.pow((data[i] - mean),2); } var = sum2 / len; System.out.println(var); } }

I really don't understand this code which is used to calculate the mean and variance from a data set.