### Question:
LocalizationUtils { public static LocalizedString[] processElementsByDefaultLocales(LocalizedString[] elements) { if (elements == null) { return null; } List<ULocale> localesList = getDefaultLocaleList(); Arrays.sort(elements, new LocaleComparator(localesList)); return filter(elements, localesList); } private  LocalizationUtils(); static LocalizedString getLocalizedElement(LocalizedString[] elements, String[] locales); static LocalizedString[] processElementsByLocales(LocalizedString[] elements, String[] locales); static LocalizedString[] processElementsByDefaultLocales(LocalizedString[] elements); static List<ULocale> getProcessedLocaleList(String[] locales); static boolean isValidLanguageTag(String tag);  }### Answer:
@Test public void testProcessElementsByDefaultLocales() { GlobalizationPreferences prefs = new GlobalizationPreferences(); ArrayList<ULocale> locales = (ArrayList<ULocale>)prefs.getLocales(); assertNotNull("Locales array is not null", locales); LocalizedString[] elements = new LocalizedString[4]; elements[0] = new LocalizedString("Hollow World", locales.get(0) .toLanguageTag()); elements[1] = new LocalizedString("Hello World", "xx-xx"); elements[2] = new LocalizedString("你好世界", "xy-xx"); elements[3] = new LocalizedString("Nom de plume!", "xz-xx"); LocalizedString[] sortedElements = LocalizationUtils .processElementsByDefaultLocales(elements); assertNotNull("Sorted elements list is not null", sortedElements); assertTrue( "First element of processed list has expected value", sortedElements[0].getLang().equals( locales.get(0).toLanguageTag())); }