Android Easter Day Get getEasterDay(int year)

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

Description

get Easter Day

Declaration

private static Calendar getEasterDay(int year) 

Method Source Code

//package com.java2s;
import java.util.*;
import static java.util.Calendar.*;

public class Main {

    private static Calendar getEasterDay(int year) {
        int a = year % 19;
        int b = year / 100;
        int c = year % 100;
        int d = b / 4;
        int e = b % 4;
        int f = (b + 8) / 25;
        int g = (b - f + 1) / 3;
        int h = ((19 * a) + b - d - g + 15) % 30;
        int i = c / 4;
        int k = c % 4;
        int l = (32 + (2 * e) + (2 * i) - h - k) % 7;
        int m = (a + (11 * h) + (22 * l)) / 451;
        int n = (h + l - (7 * m) + 114) / 31; // This is the month number.
        int p = (h + l - (7 * m) + 114) % 31; // This is the date minus one.

        return getCalendar(p + 1, n - 1, year);
    }//w  w  w . ja va  2s  .  co m

    private static Calendar getCalendar(int day, int month, int year) {
        Calendar cal = getInstance(new SimpleTimeZone(0, "GMT"));
        cal.clear();
        cal.set(YEAR, year);
        cal.set(MONTH, month);
        cal.set(DAY_OF_MONTH, day);
        return cal;
    }
}