Here you can find the source of isLeapYear(final int year)
Parameter | Description |
---|---|
year | integer based year (ex. 2000, 2011) |
public static boolean isLeapYear(final int year)
//package com.java2s; /*//from w ww . j a v a 2 s.co m * jGnash, a personal finance application * Copyright (C) 2001-2015 Craig Cavanaugh * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Determines if the supplied year is a leap year * * @param year integer based year (ex. 2000, 2011) * @return {@code true} if the given year is a leap year */ public static boolean isLeapYear(final int year) { boolean isLeapYear; isLeapYear = year % 4 == 0; isLeapYear = isLeapYear && year % 100 != 0; return isLeapYear || year % 400 == 0; } }