Java Year isLeapYear(int year)

Here you can find the source of isLeapYear(int year)

Description

is Leap Year

License

Apache License

Declaration

public static boolean isLeapYear(int year) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {

    public static boolean isLeapYear(int year) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(year, 2, 1);//w ww .ja v  a 2s. c  o m
        calendar.add(Calendar.DATE, -1);
        if (calendar.get(Calendar.DAY_OF_MONTH) == 29) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. currentYear()
  2. daysInYear(int year)
  3. differenceInYears(final Calendar a, final Calendar b)
  4. diffYears(Date day1, Date day2)
  5. IsInLeapYear(Date date1)
  6. nextYears(int diff)
  7. sameYear(Date date1, Date date2)
  8. yearAndSeason(Date date)