Created
February 3, 2012 01:00
-
-
Save vlymar/1726840 to your computer and use it in GitHub Desktop.
isLeapYear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Checks whether the given year is a leap year. | |
* @return true if and only if the input year is a leap year. | |
*/ | |
public static boolean isLeapYear(int year) { | |
if(year % 400 == 0) { | |
return true; | |
} else if(year % 100 == 0) { | |
return false; | |
} else if(year % 4 == 0) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment