is Gregorian Leap Year - Java java.util

Java examples for java.util:Year

Description

is Gregorian Leap Year

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int y = 2;
        System.out.println(isGregorianLeapYear(y));
    }//  w w w  .j  ava 2  s.c om

    public static boolean isGregorianLeapYear(int y) {
        return (y & 3) == 0 && y % 100 != 0 || y % 400 == 0;
    }
}

Related Tutorials