Number Format Example
This Example shows you how to format numbers according to the locale. In the code given below we are formatting number according to the localeMethods used in this example are described below :
NumberFormat.getNumberInstance() : NumberFormat class provides the functionality for formatting and parsing numbers. NumberFormat class also provides methods for defining which locales have number formats.
NumberFormat.format() : This method returns a format string of a number.
NumberFormatExample.java
NumberFormat.getNumberInstance(currentLocale);
|
Output :
Integer num : 123 456 789 fr_FR
|
Download code