? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1));
? ((day - 100L) * 400L) / (365L * 400L + 100L - 4L + 1L) : ((day - 100L) * 4L) / (365L * 4L + 1L));
  private void calculateDay(int[] fields, long day, boolean gregorian)  {		// the epoch is a Thursday.    int weekday = (int) (day + THURSDAY) % 7;		if (weekday <= 0)			weekday += 7;		fields[DAY_OF_WEEK] = weekday;		// get a first approximation of the year.  This may be one     // year too big.    int year = 1970               + (int) (gregorian		       ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1)		       : ((day - 100) * 4) / (365 * 4 + 1));		if (day >= 0)			year++;    long firstDayOfYear = getLinearDay(year, 1, gregorian);		// Now look in which year day really lies.    if (day < firstDayOfYear)      {			year--;			firstDayOfYear = getLinearDay(year, 1, gregorian);		}		day -= firstDayOfYear - 1; // day of year,  one based.    fields[DAY_OF_YEAR] = (int) day;    if (year <= 0)      {			fields[ERA] = BC;			fields[YEAR] = 1 - year;      }    else      {			fields[ERA] = AD;			fields[YEAR] = year;		}		int leapday = isLeapYear(year, gregorian) ? 1 : 0;    if (day <= 31 + 28 + leapday)      {	fields[MONTH] = (int) day / 32; // 31->JANUARY, 32->FEBRUARY	fields[DAY_OF_MONTH] = (int) day - 31 * fields[MONTH];      }    else      {			// A few more magic formulas	int scaledDay = ((int) day - leapday) * 5 + 8;			fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31);			fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1;		}	}