public void set(int year, int month, int date) { this.year = year; this.month = month; this.date = date; pastDays = 0; pastDays += (year - 1) * 365 + (year - 1) / 4 - (year - 1) / 100 + (year - 1) /400; for (int i = 0; i < month - 1; i++) { pastDays += monthDays[i]; if (i == 1 && isLeapYear(year)) { pastDays++; } } pastDays += date; }