Java Format - Java NumberFormat .getPercentInstance (Locale inLocale)








Syntax

NumberFormat.getPercentInstance(Locale inLocale) has the following syntax.

public static NumberFormat getPercentInstance(Locale inLocale)

Example

In the following code shows how to use NumberFormat.getPercentInstance(Locale inLocale) method.

/*  w w w  .  ja  v  a 2 s .  c o m*/
import java.text.NumberFormat;
import java.util.Locale;

public class Main {
  public static void main(String[] args) throws Exception {
    NumberFormat numberFormat = NumberFormat.getPercentInstance(Locale.CANADA);
    System.out.println(numberFormat.getMaximumFractionDigits());
  }
}

The code above generates the following result.