Here you can find the source of norm_variance(double[] array)
public static double norm_variance(double[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static double norm_variance(double[] array) { double sum = 0; for (int i = 0; i < array.length; i++) { sum += array[i];/* w w w . j ava 2 s . c o m*/ } double[] temp = new double[array.length]; for (int i = 0; i < array.length; i++) { temp[i] = array[i] / sum; } double avg = 1.0 / array.length; double var = 0; for (int i = 0; i < temp.length; i++) { var += (temp[i] - avg) * (temp[i] - avg); } return var; } }