code: protected int handleComputeMonthStart(int eyear, int month, boolean useMonth) {
  
          // 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];
              eyear += floorDivide(month, 12, rem);
              month = rem[0];
          }
  
          boolean isLeap = eyear%4 == 0;
          int y = eyear - 1;
          int julianDay = 365*y + floorDivide(y, 4) + (JAN_1_1_JULIAN_DAY - 3);
  
          isGregorian = (eyear >= gregorianCutoverYear);
          if (invertGregorian) {
              isGregorian = !isGregorian;
          }
          if (isGregorian) {
              isLeap = isLeap && ((eyear%100 != 0) || (eyear%400 == 0));
              // Add 2 because Gregorian calendar starts 2 days after
              // Julian calendar
              julianDay += floorDivide(y, 400) - floorDivide(y, 100) + 2;
          }
  
          // At this point julianDay indicates the day BEFORE the first
          // day of January 1, <eyear> of either the Julian or Gregorian
          // calendar.
  
          if (month != 0) {
              julianDay += MONTH_COUNT[month][isLeap?3:2];
          }
  
          return julianDay;
      }
docs: Return JD of start of given month/year