Java Utililty Methods Leap Year Check

List of utility methods to do Leap Year Check

Description

The list of methods to do Leap Year Check are organized into topic(s).

Method

booleanLeapYear(int year)
Leap Year
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
    return true;
} else {
    return false;
StringLeapYear(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)) {
...
intleapYearAdjustment(int year, int month)
leap Year Adjustment
return ((isLeapYear(year) && (month) >= 2) ? 1 : 0);
intleapYearBalance(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;