Locale.getAvailableLocales() has the following syntax.
public static Locale [] getAvailableLocales()
In the following code shows how to use Locale.getAvailableLocales() method.
/*w w w.j a v a2 s . c o m*/ import java.util.Locale; public class Main { public static void main(String[] args) { // create a new array and get all installed locales Locale[] locales = Locale.getAvailableLocales(); System.out.println("Installed locales are:"); for (int i = 0; i < locales.length; i++) { System.out.println(i + ":" + locales[i]); } } }
The code above generates the following result.