Here you can find the source of isLeapYear(int year)
public static boolean isLeapYear(int year)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static boolean isLeapYear(int year) { Calendar calendar = Calendar.getInstance(); calendar.set(year, 2, 1);// www. j a va 2 s . co m calendar.add(Calendar.DATE, -1); if (calendar.get(Calendar.DAY_OF_MONTH) == 29) { System.out.println(year + " year is a leap year."); return true; } else { System.out.println(year + " year is not a leap year."); return false; } } }