Java Format - Java NumberFormat .getInstance (Locale inLocale)








Syntax

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

public static NumberFormat getInstance(Locale inLocale)

Example

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

//from   www . j a  v  a  2 s  .com
import java.text.NumberFormat;
import java.util.Locale;

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

The code above generates the following result.