Here you can find the source of stdev(List
public static double stdev(List<Double> values)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 Gabriel Skantze./*from w w w . j ava 2 s. c o m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html * * Contributors: * Gabriel Skantze - initial API and implementation ******************************************************************************/ import java.util.List; public class Main { public static double stdev(List<? extends Number> data, double mean) { float variance = 0; for (Number pd : data) { variance += Math.pow((pd.doubleValue() - mean), 2) / data.size(); } return Math.sqrt(variance); } public static double stdev(List<Double> values) { return stdev(values, mean(values)); } public static double mean(List<? extends Number> data) { double mean = 0; for (Number pd : data) { mean += pd.doubleValue() / data.size(); } return mean; } }