Class CompactNumberFormatExamples
java.lang.Object
net.jrodolfo.java_evolution.java12.CompactNumberFormatExamples
Demonstrates compact number formatting, introduced in Java 12.
Before Java 12, displaying large numbers in user-friendly forms such as
1K, 1M, or localized long text usually required custom
formatting logic or a third-party library.
Java 12 added compact number formatting to NumberFormat. It solves
this presentation problem with locale-aware short and long styles.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongCompactNumber(long number, Locale locale) Formats a number with the long compact style.shortCompactNumber(long number, Locale locale) Formats a number with the short compact style.
-
Constructor Details
-
CompactNumberFormatExamples
public CompactNumberFormatExamples()
-
-
Method Details
-
shortCompactNumber
-
longCompactNumber
-