Java Internationalization - Format Percentages
Example
In this example, we're formatting numbers in percentage format.
import java.text.NumberFormat;
import java.util.Locale;
public class I18NTester {
public static void main(String[] args) {
Locale enLocale = new Locale("en", "US");
NumberFormat numberFormat = NumberFormat.getPercentInstance(enLocale);
System.out.println(numberFormat.format(0.76));
}
}
Output
It will print the following result.
76%
Advertisements