@Test public void quantityToRSStackSize() { assertEquals("0", StackFormatter.quantityToRSStackSize(0)); assertEquals("99999", StackFormatter.quantityToRSStackSize(99_999)); assertEquals("100K", StackFormatter.quantityToRSStackSize(100_000)); assertEquals("10M", StackFormatter.quantityToRSStackSize(10_000_000)); assertEquals("2147M", StackFormatter.quantityToRSStackSize(Integer.MAX_VALUE)); assertEquals("0", StackFormatter.quantityToRSStackSize(-0)); assertEquals("-400", StackFormatter.quantityToRSStackSize(-400)); assertEquals("-400K", StackFormatter.quantityToRSStackSize(-400_000)); assertEquals("-40M", StackFormatter.quantityToRSStackSize(-40_000_000)); assertEquals("-2147M", StackFormatter.quantityToRSStackSize(Integer.MIN_VALUE)); }
public static String quantityToRSStackSize(int quantity) { if (quantity == Integer.MIN_VALUE) { return "-" + quantityToRSStackSize(Integer.MAX_VALUE); } else if (quantity < 0) { return "-" + quantityToRSStackSize(-quantity); } else if (quantity < 100_000) { return Integer.toString(quantity); } else if (quantity < 10_000_000) { return quantity / 1_000 + "K"; } else { return quantity / 1_000_000 + "M"; } }
StackFormatter { public static String quantityToRSStackSize(int quantity) { if (quantity == Integer.MIN_VALUE) { return "-" + quantityToRSStackSize(Integer.MAX_VALUE); } else if (quantity < 0) { return "-" + quantityToRSStackSize(-quantity); } else if (quantity < 100_000) { return Integer.toString(quantity); } else if (quantity < 10_000_000) { return quantity / 1_000 + "K"; } else { return quantity / 1_000_000 + "M"; } } }
StackFormatter { public static String quantityToRSStackSize(int quantity) { if (quantity == Integer.MIN_VALUE) { return "-" + quantityToRSStackSize(Integer.MAX_VALUE); } else if (quantity < 0) { return "-" + quantityToRSStackSize(-quantity); } else if (quantity < 100_000) { return Integer.toString(quantity); } else if (quantity < 10_000_000) { return quantity / 1_000 + "K"; } else { return quantity / 1_000_000 + "M"; } }  }
StackFormatter { public static String quantityToRSStackSize(int quantity) { if (quantity == Integer.MIN_VALUE) { return "-" + quantityToRSStackSize(Integer.MAX_VALUE); } else if (quantity < 0) { return "-" + quantityToRSStackSize(-quantity); } else if (quantity < 100_000) { return Integer.toString(quantity); } else if (quantity < 10_000_000) { return quantity / 1_000 + "K"; } else { return quantity / 1_000_000 + "M"; } }  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 String quantityToRSStackSize(int quantity) { if (quantity == Integer.MIN_VALUE) { return "-" + quantityToRSStackSize(Integer.MAX_VALUE); } else if (quantity < 0) { return "-" + quantityToRSStackSize(-quantity); } else if (quantity < 100_000) { return Integer.toString(quantity); } else if (quantity < 10_000_000) { return quantity / 1_000 + "K"; } else { return quantity / 1_000_000 + "M"; } }  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);  }