List of utility methods to do Leap Year Check
boolean | LeapYear(int year) Leap Year if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { return true; } else { return false; |
String | LeapYear(String syear, String smonth, String sday) Leap Year long year = Long.parseLong(syear); long month = Long.parseLong(smonth); long day = Long.parseLong(sday); if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) { if (day == 31) day = 30; } else if (month == 2) { if ((day == 31) || (day == 30) || (day == 29)) { ... |
int | leapYearAdjustment(int year, int month) leap Year Adjustment return ((isLeapYear(year) && (month) >= 2) ? 1 : 0);
|
int | leapYearBalance(int yearInteger) Answer 1 if the year yearInteger is a leap year or 0 if it is not int adjustedYear = (yearInteger > 0) ? yearInteger : -(yearInteger + 1); if (((adjustedYear % 4) != 0) || (((adjustedYear % 100) == 0) && ((adjustedYear % 400) != 0))) return 0; return 1; |