calendar.setGregorianChange(new Date(Long.MIN_VALUE));
} else if (k == 2) {
calendar.setGregorianChange(new Date(Long.MAX_VALUE));
}
format.setCalendar((Calendar)calendar.clone());
Date dateBefore = calendar.getTime();
int maxYear = calendar.getActualMaximum(field);
logln("maxYear: " + maxYear + " for " + format.format(calendar.getTime()));