code: private int getNextDayOfWeek(int day, int dayOfWeek)
      {
          if (!contains(daysOfWeek, dayOfWeek))
          {
              long higher = higher(daysOfWeek, dayOfWeek);
              if (higher != 0)
              {
                  return day + (first(higher) - dayOfWeek);
              }
  
              return day + (7 - dayOfWeek) + first(daysOfWeek);
          }
  
          return day;
      }
docs: Returns the next day of the month after <tt>day</tt> that satisfies
  the dayOfWeek constraint.
  
  @param day the current 0-based day of the month
  @param dayOfWeek the current 0-based day of the week
  @return a value greater than or equal to <tt>day</tt>