My Blog

My WordPress Blog

My Blog

My WordPress Blog

Format Percentages

Example

In this example, we’re formatting numbers in percentage format.

Open Compiler

importjava.text.NumberFormat;importjava.util.Locale;publicclassI18NTester{publicstaticvoidmain(String[] args){Locale enLocale =newLocale("en","US");NumberFormat numberFormat =NumberFormat.getPercentInstance(enLocale);System.out.println(numberFormat.format(0.76));}}

Output

It will print the following result.

76%
Format Percentages

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top