Java examples for java.util:Year
Determinate leap year
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { int year = 2; System.out.println(isLeapYear(year)); }//from ww w . j ava 2 s. c om /** * Determinate leap year * @param year * @return true - is leap year, else - false */ public static boolean isLeapYear(int year) { boolean leapYear = false; if ((year % 4 == 0) && (!((year % 100 == 0) && (year % 400 != 0)))) leapYear = true; return leapYear; } }