Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static float getSampleStdDev(float[] values) { return (float) Math.sqrt(getSampleVariance(values)); } public static float getSampleVariance(float[] values) { float mean = getMean(values); float sum = 0; for (float value : values) { sum += (value - mean) * (value - mean); } return sum / (values.length - 1); } public static float getMean(float[] values) { float sum = 0; for (float value : values) { sum += value; } return sum / values.length; } }