class MathHelper {

    public static double computeConfidenceInterval(long samples, double confidenceLevel, double mean) {
        Validate.isTrue(samples > 0, "samples must be greater zero");
        Validate.isTrue(0 <= mean && mean <= 1, "mean must be in range [0,1]");
        Double z = LOC_Z_MAPPING.get(confidenceLevel);
        if (z == null) {
            throw new IllegalArgumentException("confidence level must be one of: {"
                    + StringUtils.join(CONFIDENCE_LEVELS, ", ") + "}, but was " + confidenceLevel);
        }
        return z * Math.sqrt(mean * (1 - mean) / samples);
    }

    private  MathHelper();

}