Skip to content

Instantly share code, notes, and snippets.

@vlymar
Created February 3, 2012 01:00
Show Gist options
  • Save vlymar/1726840 to your computer and use it in GitHub Desktop.
Save vlymar/1726840 to your computer and use it in GitHub Desktop.
isLeapYear
/** 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