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

intgetLeapYear(int theyear)
get Leap Year
return ((theyear % 4 == 0 && theyear % 100 != 0) || theyear % 400 == 0) ? 29 : 28;
intgetMonthOfYear(int dayOfYear, boolean leap)
Converts the number of elapsed days from beginning of the year to the corresponding month.
int d = dayOfYear;
if (d < DAYS_JANUARY) {
    return 1;
if (leap) {
    d--;
if (d < DAYS_FEBRUARY) {
...
booleanisGregorianLeapYear(int gregorianYear)
is Gregorian Leap Year
return (((gregorianYear % 4) == 0) && (((gregorianYear % 100) != 0) || ((gregorianYear % 400) == 0)));
booleanisGregorianLeapYear(int gregorianYear)
Returns whether the specified year is a leap year in the Gregorian calendar system.
return (((gregorianYear % 4) == 0) && (((gregorianYear % 100) != 0) || ((gregorianYear % 400) == 0)));
booleanisJalaliLeapYear(int year)
is Jalali Leap Year
int mod = (year + 11) % 33;
if ((mod != 32) && ((mod % 4) == 0)) {
    return true;
} else {
    return false;
booleanisJulianLeapYear(int normalizedJulianYear)
Returns whether the specified year is a leap year in the Julian calendar system.
return (normalizedJulianYear % 4) == 0;
booleanisJulianLeapYear(int normalizedJulianYear)
is Julian Leap Year
return (normalizedJulianYear % 4) == 0;
booleanisLeapYear(final int year)
Determines if the supplied year is a leap year
boolean isLeapYear;
isLeapYear = year % 4 == 0;
isLeapYear = isLeapYear && year % 100 != 0;
return isLeapYear || year % 400 == 0;
booleanisLeapYear(final int year)
is Leap Year
return ((year % 4) == 0) 
        && ((year < 1582) 
                || ((year % 100) != 0) 
                || ((year % 400) == 0)); 
booleanisLeapYear(int prolepticYear)
Checks if the year is a leap year, according to the ISO proleptic calendar system rules.
return ((prolepticYear & 3) == 0) && ((prolepticYear % 100) != 0 || (prolepticYear % 400) == 0);