import java.util.Locale; public class Main { public static void main(String[] argv) throws Exception { Locale[] locales = Locale.getAvailableLocales(); for (int i = 0; i < locales.length; i++) { // Get the 2-letter language code String language = locales[i].getLanguage(); } } }