1 public static List<Date> getWorkDates(int year, int month) { 2 List<Date> dates = new ArrayList<>(); 3 Calendar cal = Calendar.getInstance(); 4 cal.set(Calendar.YEAR, year); 5 cal.set(Calendar.MONTH, month - 1); 6 cal.set(Calendar.DATE, 1); 7 while (cal.get(Calendar.YEAR) == year && 8 cal.get(Calendar.MONTH) < month) { 9 int day = cal.get(Calendar.DAY_OF_WEEK); 10 11 if (!(day == Calendar.SUNDAY || day == Calendar.SATURDAY)) { 12 dates.add((Date) cal.getTime().clone()); 13 } 14 cal.add(Calendar.DATE, 1); 15 } 16 return dates; 17 }