Java Leap Year Check isLeapYear(int year)

Here you can find the source of isLeapYear(int year)

Description

Cheks is leap year or not

License

Apache License

Parameter

Parameter Description
year Year value

Return

True if leap year, false otherwise

Declaration

public static boolean isLeapYear(int year) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from   ww  w  .j ava 2s . c om
     * Cheks is leap year or not
     * 
     * @param year Year value
     * @return True if leap year, false otherwise
     */
    public static boolean isLeapYear(int year) {
        if (year < 1582) {
            if (year % 4 == 0)
                return true;
        }
        if (year % 100 == 0 && (year / 100) % 4 != 0)
            return false;
        if (year % 4 == 0)
            return true;
        return false;
    }
}

Related

  1. isLeapYear(int year)
  2. isLeapYear(int year)
  3. isLeapYear(int year)
  4. isLeapYear(int year)
  5. isLeapYear(int year)
  6. isLeapYear(int year)
  7. isLeapYear(int year)
  8. isLeapYear(int year)
  9. isLeapYear(Integer year)