AddressUtils { @Nonnull public static String formatPostcalCodeAndCity( @Nonnull final Locale locale, @Nonnull final String postalCode, @Nonnull final String city) { assert postalCode != null; assert city != null; final String result; if (city.isEmpty()) { result = postalCode; } else { if (postalCode.isEmpty()) { result = city; } else { if (isEnglish(locale)) { result = city + ", " + postalCode; } else { result = postalCode + " " + city; } } } return result; } 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 testFormatPostalCodeAndCity() { LOG.info("testFormatPostalCodeAndCity"); final Locale nl = new Locale("nl", "NL"); final Locale e1 = new Locale("en", "UK"); final Locale e2 = Locale.ENGLISH; Assert.assertEquals("1 2", AddressUtils.formatPostcalCodeAndCity(nl, "1", "2")); Assert.assertEquals("2, 1", AddressUtils.formatPostcalCodeAndCity(e1, "1", "2")); Assert.assertEquals("2, 1", AddressUtils.formatPostcalCodeAndCity(e2, "1", "2")); }