Here you can find the source of Variance(double[] in, double mean)
public static final double Variance(double[] in, double mean)
//package com.java2s; //License from project: Open Source License public class Main { public static final double Variance(double[] in, double mean) { double sum = 0.0; int nelem = 0; for (int i = 0, s = in.length; i < s; i++) sum += (in[i] - mean) * (in[i] - mean); return sum / (in.length - 1.0); }//from w ww . j av a 2 s . c o m }