Last active
August 29, 2015 14:21
-
-
Save flogvit/32639d4745c0f8b69df8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Small class for getting Easter Sunday at a specific year | |
*/ | |
public class Easter { | |
public static Calendar get(int year) { | |
int y = year; | |
int a = y % 19; | |
int b = y / 100; | |
int c = y % 100; | |
int d = b / 4; | |
int e = b % 4; | |
int g = (8 * b + 13) / 25; | |
int h = (19 * a + b - d - g + 15) % 30; | |
int j = c / 4; | |
int k = c % 4; | |
int m = (a + 11 * h) / 319; | |
int r = (2 * e + 2 * j - k - h + m + 32) % 7; | |
int n = (h - m + r + 90) / 25; | |
int p = (h - m + r + n + 19) % 32; | |
Calendar cal = Calendar.getInstance(); | |
cal.clear(); | |
cal.set(y, n, p); | |
return cal; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment