JDK-8214515 : Release Note: Support for Compact Number Formatting
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 12
  • Priority: P4
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2018-11-30
  • Updated: 2019-04-09
  • Resolved: 2018-12-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 12
`NumberFormat` adds support for formatting a number in its compact form. Compact number formatting refers to the representation of a number in a short or human readable form. For example, in the en_US locale, 1000 can be formatted as "1K" and 1000000 can be formatted as "1M", depending upon the style specified by `NumberFormat.Style`. The compact number formats are defined by LDML's specification for [Compact Number Formats](http://unicode.org/reports/tr35/tr35-numbers.html#Compact_Number_Formats). To obtain an instance, use one of the factory methods given by `NumberFormat` for compact number formatting. For example:

NumberFormat fmt = NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT);
String result = fmt.format(1000);

The example above results in "1K".