Java Easter getSundayOfEaster(final int year)

Here you can find the source of getSundayOfEaster(final int year)

Description

get Sunday Of Easter

License

Open Source License

Declaration

protected static Calendar getSundayOfEaster(final int year) 

Method Source Code

//package com.java2s;
/*/*from w w  w  . j a  v a  2  s  .  c  o m*/
 * Copyright (C) 2013 Marcius da Silva da Fonseca.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA
 */

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {
    protected static Calendar getSundayOfEaster(final int year) {
        // step 2
        int a = year % 19;
        // step 3
        int b = year / 100;
        int c = year % 100;
        // step 4
        int d = b / 4;
        int e = b % 4;
        // step 5
        int g = (8 * b + 13) / 25;
        // step 6
        int h = (19 * a + b - d - g + 15) % 30;
        // step 7
        int j = c / 4;
        int k = c % 4;
        // step 8
        int m = (a + 11 * h) / 319;
        // step 9
        int r = (2 * e + 2 * j - k - h + m + 32) % 7;
        // step 10
        int n = (h - m + r + 90) / 25;
        // step 11 (finally)
        int p = (h - m + r + n + 19) % 32;
        return new GregorianCalendar(year, n - 1, p);
    }
}

Related

  1. calculateEasterDay(int year)
  2. getEasterDay(int year)