QuantityUtils { public static double scaleByMultipler(double amount, String multiplier) { if (multiplier != null) { switch (multiplier.toLowerCase()) { case "hundred": return amount * 100; case "k": case "thousand": return amount * 1000; case "m": case "million": return amount * 1000000; case "b": case "billion": return amount * 1000000000; case "t": case "trillion": return amount * 1000000000000L; default: return amount; } } return amount; } private  QuantityUtils(); static Quantity createQuantity(
      JCas aJCas,
      Matcher matcher,
      String unit,
      double scale,
      String normalizedUnit,
      String quantityType); static int countPeriods(String haystack); static double scaleByMultipler(double amount, String multiplier);  }
@Test public void testConvertQuantityMagnitude() { Double amount = 10d; assertEquals(10.0, QuantityUtils.scaleByMultipler(amount, null), 0.001); assertEquals(10.0, QuantityUtils.scaleByMultipler(amount, ""), 0.001); assertEquals(10.0, QuantityUtils.scaleByMultipler(amount, "zillion"), 0.001); assertEquals(1000.0, QuantityUtils.scaleByMultipler(amount, "hundred"), 0.001); assertEquals(10000.0, QuantityUtils.scaleByMultipler(amount, "k"), 0.001); assertEquals(10000.0, QuantityUtils.scaleByMultipler(amount, "thousand"), 0.001); assertEquals(10000000.0, QuantityUtils.scaleByMultipler(amount, "m"), 0.001); assertEquals(10000000.0, QuantityUtils.scaleByMultipler(amount, "million"), 0.001); assertEquals(10000000000.0, QuantityUtils.scaleByMultipler(amount, "b"), 0.001); assertEquals(10000000000.0, QuantityUtils.scaleByMultipler(amount, "billion"), 0.001); assertEquals(10000000000000.0, QuantityUtils.scaleByMultipler(amount, "t"), 0.001); assertEquals(10000000000000.0, QuantityUtils.scaleByMultipler(amount, "trillion"), 0.001); }