Java List Print printStats(final List shocktimes)

Here you can find the source of printStats(final List shocktimes)

Description

print Stats

License

Open Source License

Declaration

public static void printStats(final List<Long> shocktimes) 

Method Source Code

//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);
    }
}

Related

  1. printObjectList(List list)
  2. printout(List record)
  3. printPerformanceStats(String message, List iterationTimesInNanoseconds)
  4. printQueryResults(List res)
  5. printRules(List rules, Class clazz)
  6. printStringList(List list, String name)
  7. printStringList(List listToPrint)
  8. printStringList(List strings)
  9. printTable(List data)

  10. HOME | Copyright © www.java2s.com 2016