SHARE
TWEET

Untitled

a guest Sep 17th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. protected static Date getEasterSunday(int year) {
  2.         Calendar calendar = Calendar.getInstance();
  3.         int initialYear = year;
  4.        
  5.         if (year < 1900) {
  6.             year += 1900;
  7.         }
  8.        
  9.         int a = year % 19;
  10.         int b = year / 100;
  11.         int c = year % 100;
  12.         int d = b / 4;
  13.         int e = b % 4;
  14.         int f = (b + 8) / 25;
  15.         int g = (b - f + 1) / 3;
  16.         int h = (19 * a + b - d - g + 15) % 30;
  17.         int i = c / 4;
  18.         int j = c % 4;
  19.         int k = (32 + 2 * e + 2 * i - h - j) % 7;
  20.         int l = (a + 11 * h + 22 * k) / 451;
  21.         int m = (h + k - 7 * l + 114) % 31;
  22.         int month = (h + k - 7 * l + 114) / 31 - 1;
  23.         int day = m + 1;
  24.        
  25.         calendar.set(initialYear, month, day);
  26.        
  27.         return calendar.getTime();
  28.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top