docs: static Generator byDayGenerator(
              WeekdayNum[] days, final boolean weeksInYear, final DateValue dtStart) {
          final WeekdayNum[] udays = days.clone();
  
          return new Generator() {
              int year = dtStart.year();
              int month = dtStart.month();
              /** list of generated dates for the current month */
              int[] dates;
              /** index of next date to return */
              int i = 0;
  
              {
                  generateDates();
                  int day = dtStart.day();
                  while (i < dates.length && dates[i] < day) {
                      ++i;
                  }
              }
  
              void generateDates() {
                  int nDays;
                  Weekday dow0;
                  int nDaysInMonth = TimeUtils.monthLength(year, month);
                  // index of the first day of the month in the month or year
                  int d0;
  
                  if (weeksInYear) {
                      nDays = TimeUtils.yearLength(year);
                      dow0 = Weekday.firstDayOfWeekInMonth(year, 1);
                      d0 = TimeUtils.dayOfYear(year, month, 1);
                  } else {
                      nDays = nDaysInMonth;
                      dow0 = Weekday.firstDayOfWeekInMonth(year, month);
                      d0 = 0;
                  }
  
                  // an index not greater than the first week of the month in the month
                  // or year
                  int w0 = d0 / 7;
  
                  // iterate through days and resolve each [week, day of week] pair to a
                  // day of the month
                  IntSet udates = new IntSet();
                  for (int j = 0; j < udays.length; ++j) {
                      WeekdayNum day = udays[j];
                      if (0 != day.num) {
                          int date = Util.dayNumToDate(
                                  dow0, nDays, day.num, day.wday, d0, nDaysInMonth);
                          if (0 != date) {
                              udates.add(date);
                          }
                      } else {
                          int wn = w0 + 6;
                          for (int w = w0; w <= wn; ++w) {
                              int date = Util.dayNumToDate(
                                      dow0, nDays, w, day.wday, d0, nDaysInMonth);
                              if (0 != date) {
                                  udates.add(date);
                              }
                          }
                      }
                  }
                  dates = udates.toIntArray();
              }
  
              @Override
              boolean generate(DTBuilder builder) {
                  if (year != builder.year || month != builder.month) {
                      year = builder.year;
                      month = builder.month;
  
                      generateDates();
                      // start at the beginning of the month
                      i = 0;
                  }
                  if (i >= dates.length) {
                      return false;
                  }
                  builder.day = dates[i++];
                  return true;
              }
  
              @Override
              public String toString() {
                  return "byDayGenerator:" + Arrays.toString(udays)
                          + " by " + (weeksInYear ? "year" : "week");
              }
          };
      }