code: protected int computeGregorianMonthStart(int year, int month) {
  
          // If the month is out of range, adjust it into range, and
          // modify the extended year value accordingly.
          if (month < 0 || month > 11) {
              int[] rem = new int[1];
              year += floorDivide(month, 12, rem);
              month = rem[0];
          }
  
          boolean isLeap = (year%4 == 0) && ((year%100 != 0) || (year%400 == 0));
          int y = year - 1;
          // This computation is actually ... + (JAN_1_1_JULIAN_DAY - 3) + 2.
          // Add 2 because Gregorian calendar starts 2 days after Julian
          // calendar.
          int julianDay = 365*y + floorDivide(y, 4) - floorDivide(y, 100) +
                  floorDivide(y, 400) + JAN_1_1_JULIAN_DAY - 1;
  
          // At this point julianDay indicates the day BEFORE the first day
          // of January 1, <eyear> of the Gregorian calendar.
          if (month != 0) {
              julianDay += GREGORIAN_MONTH_COUNT[month][isLeap?3:2];
          }
  
          return julianDay;
      }
docs: Compute the Julian day of a month of the Gregorian calendar.
  Subclasses may call this method to perform a Gregorian calendar
  fields-&gt;millis computation.  To perform a Gregorian calendar
  millis-&gt;fields computation, call computeGregorianFields().
  @param year extended Gregorian year
  @param month zero-based Gregorian month
  @return the Julian day number of the day before the first
  day of the given month in the given extended year
  @see #computeGregorianFields