Here you can find the source of stddev(final double[] in, final int start, final int length)
public static double stddev(final double[] in, final int start, final int length)
//package com.java2s; //License from project: Open Source License public class Main { /** Calculate the (population) standard deviation of an array of doubles. */ public static double stddev(final double[] in, final int start, final int length) { return stddev(in, start, length, mean(in, start, length)); }//from ww w . java2s .c o m /** Calculate the (population) standard deviation of an array of doubles. */ public static double stddev(final double[] in, final int start, final int stop, final double mean) { if ((stop - start) <= 0) return Double.NaN; double total = 0; for (int i = start; i < stop; ++i) { total += (in[i] * in[i]); } return Math.sqrt((total / (stop - start)) - (mean * mean)); } /** Calculate the mean of an array of doubles. */ public static double mean(final double[] in, final int start, final int stop) { if ((stop - start) <= 0) return Double.NaN; double total = 0; for (int i = start; i < stop; ++i) { total += in[i]; } return total / (stop - start); } }