private int checkDay(int testDay) {
        if(testDay > 0 && testDay <= daysPerMonth[month]) 
            return testDay;
        if(month == 2 && testDay == 29 && (year %400 == 0 ||
                (year % 4 == 0 && year %100 != 0)))
            return testDay;
        throw new IllegalArgumentException(
                "Day out-of-range for the specified month and year");
    }