SearchUtil { public static String longToVal(final String value, final int scale) { try { final BigDecimal decimal = new BigDecimal(value); return decimal.movePointLeft(scale).stripTrailingZeros().toPlainString(); } catch (Exception exp) { } return "0"; }  static List<String> splitForSearch(final String phrase, final int charThreshold); static String priceFacetName(final long shopId, final String currency); static long priceToLong(final BigDecimal price); static Long valToLong(final String value, final int scale); static String longToVal(final String value, final int scale); static void destroy(); static void addDestroyable(final Destroyable destroyable);  }
@Test public void testLongToVal() throws Exception { assertEquals("0", SearchUtil.longToVal("0", 2)); assertEquals("10000000000", SearchUtil.longToVal("1000000000000", 2)); assertEquals("1000", SearchUtil.longToVal("100000", 2)); assertEquals("10", SearchUtil.longToVal("1000", 2)); assertEquals("0.01", SearchUtil.longToVal("1", 2)); assertEquals("1.33", SearchUtil.longToVal("133", 2)); assertEquals("3.21", SearchUtil.longToVal("321", 2)); assertEquals("0.12", SearchUtil.longToVal("12", 2)); assertEquals("0.98", SearchUtil.longToVal("98", 2)); assertEquals("98.22", SearchUtil.longToVal("9822", 2)); assertEquals("98.56", SearchUtil.longToVal("9856", 2)); assertEquals("0", SearchUtil.longToVal("98.555zzz", 2)); }