boolean (String candidateLanguageTerritory) { Locale[] available = Locale.getAvailableLocales(); for (Locale l : available) { if (Objects.equals(l.toString(), candidateLanguageTerritory)) { return true; } } return false; }