Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8177552 Compact Number Formatting support
  3. JDK-8214515

Release Note: Support for Compact Number Formatting

XMLWordPrintable

    • Verified

      `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".

            nishjain Nishit Jain
            nishjain Nishit Jain
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: