@Test public void stackSizeToQuantity() throws ParseException { assertEquals(0, StackFormatter.stackSizeToQuantity("0")); assertEquals(907, StackFormatter.stackSizeToQuantity("907")); assertEquals(1200, StackFormatter.stackSizeToQuantity("1200")); assertEquals(10_500, StackFormatter.stackSizeToQuantity(NumberFormat.getNumberInstance().format(10_500))); assertEquals(10_500, StackFormatter.stackSizeToQuantity(NumberFormat.getNumberInstance().format(10.5) + "K")); assertEquals(33_560_000, StackFormatter.stackSizeToQuantity(NumberFormat.getNumberInstance().format(33.56) + "M")); assertEquals(2_000_000_000, StackFormatter.stackSizeToQuantity("2B")); assertEquals(0, StackFormatter.stackSizeToQuantity("-0")); assertEquals(-400, StackFormatter.stackSizeToQuantity("-400")); assertEquals(-400_000, StackFormatter.stackSizeToQuantity("-400k")); assertEquals(-40_543_000, StackFormatter.stackSizeToQuantity(NumberFormat.getNumberInstance().format(-40.543) + "M")); try { StackFormatter.stackSizeToQuantity("0L"); fail("Should have thrown an exception for invalid suffix."); } catch (ParseException ignore) { } try { StackFormatter.stackSizeToQuantity("badstack"); fail("Should have thrown an exception for improperly formatted stack."); } catch (ParseException ignore) { } }
public static long stackSizeToQuantity(String string) throws ParseException { int multiplier = getMultiplier(string); float parsedValue = NUMBER_FORMATTER.parse(string).floatValue(); return (long) (parsedValue * multiplier); }
StackFormatter { public static long stackSizeToQuantity(String string) throws ParseException { int multiplier = getMultiplier(string); float parsedValue = NUMBER_FORMATTER.parse(string).floatValue(); return (long) (parsedValue * multiplier); } }
StackFormatter { public static long stackSizeToQuantity(String string) throws ParseException { int multiplier = getMultiplier(string); float parsedValue = NUMBER_FORMATTER.parse(string).floatValue(); return (long) (parsedValue * multiplier); }  }
StackFormatter { public static long stackSizeToQuantity(String string) throws ParseException { int multiplier = getMultiplier(string); float parsedValue = NUMBER_FORMATTER.parse(string).floatValue(); return (long) (parsedValue * multiplier); }  static String quantityToStackSize(long quantity); static String quantityToRSStackSize(int quantity); static long stackSizeToQuantity(String string); static String formatNumber(final long number); static String formatNumber(double number); }
StackFormatter { public static long stackSizeToQuantity(String string) throws ParseException { int multiplier = getMultiplier(string); float parsedValue = NUMBER_FORMATTER.parse(string).floatValue(); return (long) (parsedValue * multiplier); }  static String quantityToStackSize(long quantity); static String quantityToRSStackSize(int quantity); static long stackSizeToQuantity(String string); static String formatNumber(final long number); static String formatNumber(double number);  }