Based on the wiki you submitted, I solved it for myself with the following code:
private static final List<String> sunWeekendDaysCountries = Arrays.asList(new String[]{"GQ", "IN", "TH", "UG"}); private static final List<String> fryWeekendDaysCountries = Arrays.asList(new String[]{"DJ", "IR"}); private static final List<String> frySunWeekendDaysCountries = Arrays.asList(new String[]{"BN"}); private static final List<String> thuFryWeekendDaysCountries = Arrays.asList(new String[]{"AF"}); private static final List<String> frySatWeekendDaysCountries = Arrays.asList(new String[]{"AE", "DZ", "BH", "BD", "EG", "IQ", "IL", "JO", "KW", "LY", "MV", "MR", "OM", "PS", "QA", "SA", "SD", "SY", "YE"}); public static int[] getWeekendDays(Locale locale) { if (thuFryWeekendDaysCountries.contains(locale.getCountry())) { return new int[]{Calendar.THURSDAY, Calendar.FRIDAY}; } else if (frySunWeekendDaysCountries.contains(locale.getCountry())) { return new int[]{Calendar.FRIDAY, Calendar.SUNDAY}; } else if (fryWeekendDaysCountries.contains(locale.getCountry())) { return new int[]{Calendar.FRIDAY}; } else if (sunWeekendDaysCountries.contains(locale.getCountry())) { return new int[]{Calendar.SUNDAY}; } else if (frySatWeekendDaysCountries.contains(locale.getCountry())) { return new int[]{Calendar.FRIDAY, Calendar.SATURDAY}; } else { return new int[]{Calendar.SATURDAY, Calendar.SUNDAY}; } }
source share