test_class.file: runelite-client/src/test/java/net/runelite/client/util/QuantityFormatterTest.java
test_class.identifier: QuantityFormatterTest
test_case.body: @Test
  	public void quantityToStackSize()
  	{
  		assertEquals("0", QuantityFormatter.quantityToStackSize(0));
  		assertEquals("999", QuantityFormatter.quantityToStackSize(999));
  		assertEquals("1,000", QuantityFormatter.quantityToStackSize(1000));
  		assertEquals("9,450", QuantityFormatter.quantityToStackSize(9450));
  		assertEquals("14.5K", QuantityFormatter.quantityToStackSize(14_500));
  		assertEquals("99.9K", QuantityFormatter.quantityToStackSize(99_920));
  		assertEquals("100K", QuantityFormatter.quantityToStackSize(100_000));
  		assertEquals("10M", QuantityFormatter.quantityToStackSize(10_000_000));
  		assertEquals("2.14B", QuantityFormatter.quantityToStackSize(Integer.MAX_VALUE));
  		assertEquals("100B", QuantityFormatter.quantityToStackSize(100_000_000_000L));
  
  		assertEquals("0", QuantityFormatter.quantityToStackSize(-0));
  		assertEquals("-400", QuantityFormatter.quantityToStackSize(-400));
  		assertEquals("-400K", QuantityFormatter.quantityToStackSize(-400_000));
  		assertEquals("-40M", QuantityFormatter.quantityToStackSize(-40_000_000));
  		assertEquals("-2.14B", QuantityFormatter.quantityToStackSize(Integer.MIN_VALUE));
  		assertEquals("-400B", QuantityFormatter.quantityToStackSize(-400_000_000_000L));
  	}
test_case.class_method_signature: QuantityFormatterTest.quantityToStackSize()
test_case.full_signature: @Test public void quantityToStackSize()
test_case.identifier: quantityToStackSize
test_case.invocations: assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize assertEquals quantityToStackSize
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void quantityToStackSize()
focal_class.declarator: SUFFIXES = {"", "K", "M", "B"}
focal_class.modifier: private static final
focal_class.original_string: private static final String[] SUFFIXES = {"", "K", "M", "B"};
focal_class.type: String[]
focal_class.var_name: SUFFIXES
focal_class.declarator: SUFFIX_PATTERN = Pattern.compile("^-?[0-9,.]+([a-zA-Z]?)$")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern SUFFIX_PATTERN = Pattern.compile("^-?[0-9,.]+([a-zA-Z]?)$");
focal_class.type: Pattern
focal_class.var_name: SUFFIX_PATTERN
focal_class.declarator: NUMBER_FORMATTER = NumberFormat.getInstance(Locale.ENGLISH)
focal_class.modifier: private static final
focal_class.original_string: private static final NumberFormat NUMBER_FORMATTER = NumberFormat.getInstance(Locale.ENGLISH);
focal_class.type: NumberFormat
focal_class.var_name: NUMBER_FORMATTER
focal_class.declarator: DECIMAL_FORMATTER = new DecimalFormat(
  		"#,###.#",
  		DecimalFormatSymbols.getInstance(Locale.ENGLISH)
  	)
focal_class.modifier: private static final
focal_class.original_string: private static final NumberFormat DECIMAL_FORMATTER = new DecimalFormat(
  		"#,###.#",
  		DecimalFormatSymbols.getInstance(Locale.ENGLISH)
  	);
focal_class.type: NumberFormat
focal_class.var_name: DECIMAL_FORMATTER
focal_class.declarator: PRECISE_DECIMAL_FORMATTER = new DecimalFormat(
  		"#,###.###",
  		DecimalFormatSymbols.getInstance(Locale.ENGLISH)
  	)
focal_class.modifier: private static final
focal_class.original_string: private static final NumberFormat PRECISE_DECIMAL_FORMATTER = new DecimalFormat(
  		"#,###.###",
  		DecimalFormatSymbols.getInstance(Locale.ENGLISH)
  	);
focal_class.type: NumberFormat
focal_class.var_name: PRECISE_DECIMAL_FORMATTER
focal_class.file: runelite-client/src/main/java/net/runelite/client/util/QuantityFormatter.java
focal_class.identifier: QuantityFormatter
focal_class.class_method_signature: QuantityFormatter.quantityToStackSize(long quantity)
focal_class.full_signature: public static synchronized String quantityToStackSize(long quantity)
focal_class.identifier: quantityToStackSize
focal_class.modifiers: public static synchronized
focal_class.parameters: (long quantity)
focal_class.return: String
focal_class.signature: String quantityToStackSize(long quantity)
focal_class.class_method_signature: QuantityFormatter.quantityToRSDecimalStack(int quantity)
focal_class.full_signature: public static String quantityToRSDecimalStack(int quantity)
focal_class.identifier: quantityToRSDecimalStack
focal_class.modifiers: public static
focal_class.parameters: (int quantity)
focal_class.return: String
focal_class.signature: String quantityToRSDecimalStack(int quantity)
focal_class.class_method_signature: QuantityFormatter.quantityToRSDecimalStack(int quantity, boolean precise)
focal_class.full_signature: public static synchronized String quantityToRSDecimalStack(int quantity, boolean precise)
focal_class.identifier: quantityToRSDecimalStack
focal_class.modifiers: public static synchronized
focal_class.parameters: (int quantity, boolean precise)
focal_class.return: String
focal_class.signature: String quantityToRSDecimalStack(int quantity, boolean precise)
focal_class.class_method_signature: QuantityFormatter.parseQuantity(String string)
focal_class.full_signature: public static synchronized long parseQuantity(String string)
focal_class.identifier: parseQuantity
focal_class.modifiers: public static synchronized
focal_class.parameters: (String string)
focal_class.return: long
focal_class.signature: long parseQuantity(String string)
focal_class.class_method_signature: QuantityFormatter.formatNumber(final long number)
focal_class.full_signature: public static synchronized String formatNumber(final long number)
focal_class.identifier: formatNumber
focal_class.modifiers: public static synchronized
focal_class.parameters: (final long number)
focal_class.return: String
focal_class.signature: String formatNumber(final long number)
focal_class.class_method_signature: QuantityFormatter.formatNumber(double number)
focal_class.full_signature: public static synchronized String formatNumber(double number)
focal_class.identifier: formatNumber
focal_class.modifiers: public static synchronized
focal_class.parameters: (double number)
focal_class.return: String
focal_class.signature: String formatNumber(double number)
focal_class.class_method_signature: QuantityFormatter.getMultiplier(String string)
focal_class.full_signature: private static int getMultiplier(String string)
focal_class.identifier: getMultiplier
focal_class.modifiers: private static
focal_class.parameters: (String string)
focal_class.return: int
focal_class.signature: int getMultiplier(String string)
focal_method.body: public static synchronized String quantityToStackSize(long quantity)
  	{
  		if (quantity < 0)
  		{
  			// Long.MIN_VALUE = -1 * Long.MIN_VALUE so we need to correct for it.
  			return "-" + quantityToStackSize(quantity == Long.MIN_VALUE ? Long.MAX_VALUE : -quantity);
  		}
  		else if (quantity < 10_000)
  		{
  			return NUMBER_FORMATTER.format(quantity);
  		}
  
  		String suffix = SUFFIXES[0];
  		long divideBy = 1;
  
  		// determine correct suffix by iterating backward through the list
  		// of suffixes until the suffix results in a value >= 1
  		for (int i = (SUFFIXES.length - 1); i >= 0; i--)
  		{
  			divideBy = (long) Math.pow(10, i * 3);
  			if ((double) quantity / divideBy >= 1)
  			{
  				suffix = SUFFIXES[i];
  				break;
  			}
  		}
  
  		// get locale formatted string
  		String formattedString = NUMBER_FORMATTER.format((double) quantity / divideBy);
  
  		// strip down any digits past the 4 first
  		formattedString = (formattedString.length() > 4 ? formattedString.substring(0, 4) : formattedString);
  
  		// make sure the last character is not a "."
  		return (formattedString.endsWith(".") ? formattedString.substring(0, 3) : formattedString) + suffix;
  	}
focal_method.class_method_signature: QuantityFormatter.quantityToStackSize(long quantity)
focal_method.full_signature: public static synchronized String quantityToStackSize(long quantity)
focal_method.identifier: quantityToStackSize
focal_method.invocations: quantityToStackSize format pow format length substring endsWith substring
focal_method.modifiers: public static synchronized
focal_method.parameters: (long quantity)
focal_method.return: String
focal_method.signature: String quantityToStackSize(long quantity)