AddressUtils { public static boolean isValidCountryISO2(@Nullable final String countryCode) { if ((countryCode == null) || (countryCode.length() != 2)) { return false; } final int index = Arrays.binarySearch(Locale.getISOCountries(), countryCode, (String o1, final String o2) -> o1.compareTo(o2)); return index >= 0; } private  AddressUtils(); static boolean isValidCountryISO2(@Nullable final String countryCode); @Nonnull static String getDisplayCountry(@Nonnull final String countryISO2); @Nonnull static String getDisplayCountry(@Nonnull final String countryISO2, @Nonnull final Locale language); @Nonnull static String formatStreetWithHouseNumber(
            @Nonnull final Locale locale,
            @Nonnull final String street,
            @Nullable final Integer houseNumber,
            @Nullable final String houseNumberPostfix); @Nonnull static String formatPostcalCodeAndCity(
            @Nonnull final Locale locale,
            @Nonnull final String postalCode,
            @Nonnull final String city);  }
@Test public void testIsValidCountryISO2() { LOG.info("testIsValidCountryISO2"); Assert.assertTrue(AddressUtils.isValidCountryISO2("NL")); Assert.assertTrue(AddressUtils.isValidCountryISO2("GB")); Assert.assertTrue(AddressUtils.isValidCountryISO2("US")); Assert.assertFalse(AddressUtils.isValidCountryISO2("UK")); Assert.assertFalse(AddressUtils.isValidCountryISO2("UW")); Assert.assertFalse(AddressUtils.isValidCountryISO2("AA")); }