Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.*;
import static java.lang.Math.*;

public class Main {
    /**
     * @param mathExpectation math expectation for full list
     * @return dispersion on full array
     */
    private static double dispersionForFull(double mathExpectation, Map<String, Long> pressingLength) {
        double sum = 0.0;
        for (String key : pressingLength.keySet()) {
            double x = pressingLength.get(key) - mathExpectation;
            sum += x * x;
        }
        return sqrt(sum / (pressingLength.size() - 1));
    }
}