Java Format - Java NumberFormat .getAvailableLocales ()








Syntax

NumberFormat.getAvailableLocales() has the following syntax.

public static Locale [] getAvailableLocales()

Example

In the following code shows how to use NumberFormat.getAvailableLocales() method.

//from  w  ww .ja  v  a2  s  . c o m
import java.text.NumberFormat;
import java.util.Locale;

public class Main {
  public static void main(String[] args) throws Exception {
    Locale[] locales = NumberFormat.getAvailableLocales();
    for(Locale locale: locales){
      System.out.println(locale.getDisplayCountry());
    }
  }
}

The code above generates the following result.