Here you can find the source of printStats(final List
public static void printStats(final List<Long> shocktimes)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static void printStats(final List<Long> shocktimes) { System.out.println("N: " + shocktimes.size()); long sum = 0; for (final Long l : shocktimes) { sum += l;/*from ww w. j a v a2 s. c o m*/ } final double mean = (sum / (double) shocktimes.size()) / 1000000000.0; System.out.println("Mean: " + mean); double ss = 0; for (final Long l : shocktimes) { ss += Math.pow((l - mean), 2); } final double stddev = Math.pow(ss / (shocktimes.size() - 1), 0.5) / 1000000000.0; System.out.println("Stddev (sample): " + stddev); } }