Here you can find the source of variance(double[] array)
public static double variance(double[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static double variance(double[] array) { double variance = 0; double mean = 0; for (int i = 0; i < array.length; i++) { mean += array[i];/*from www .jav a 2s . com*/ } mean /= array.length; for (int i = 0; i < array.length; i++) { variance += Math.pow((array[i] - mean), 2); } variance /= array.length; return variance; } }