PredictionIntervalMultipliers { public static double multiplier(int percentage) { if (percentage < 0 || percentage > 100) { throw new IllegalArgumentException(); } Double multiplier = cashedMultipliers.get(percentage); if (multiplier == null) { NormalDistribution normalDistribution = new NormalDistribution(0, 1); multiplier = normalDistribution.inverseCumulativeProbability(0.5 + (percentage*0.01)/2); cashedMultipliers.put(percentage, multiplier); } return multiplier; } private  PredictionIntervalMultipliers(); static double multiplier(int percentage);  }
@Test public void testMultiplier() { Assert.assertEquals(0.67d, PredictionIntervalMultipliers.multiplier(50), 0.01); Assert.assertEquals(1.28d, PredictionIntervalMultipliers.multiplier(80), 0.01); Assert.assertEquals(1.96d, PredictionIntervalMultipliers.multiplier(95), 0.01); Assert.assertEquals(0d, PredictionIntervalMultipliers.multiplier(0), 0.01); Assert.assertEquals(Double.POSITIVE_INFINITY, PredictionIntervalMultipliers.multiplier(100), 0.01); }