@Test public void testEaster2() { for (int i = 1900; i < 4100; ++i) { Day easter = Utilities.easter(i); Day easter2 = Utilities.easter2(i); Assert.assertEquals(easter, easter2); } }
public static Day easter2(int y) { int firstdig = y / 100; int remain19 = y % 19; int temp = (firstdig - 15) / 2 + 202 - 11 * remain19; if (firstdig == 21 || firstdig == 24 || firstdig == 25 || (firstdig >= 27 && firstdig <= 32) || firstdig == 34 || firstdig == 35 || firstdig == 38) { --temp; } else if (firstdig == 33 || firstdig == 36 || firstdig == 37 || firstdig == 39 || firstdig == 40) { temp -= 2; } temp = temp % 30; int ta = temp + 21; if (temp == 29) { --ta; } if (temp == 28 && remain19 > 10) { --ta; } int tb = (ta - 19) % 7; int tc = (40 - firstdig) % 4; if (tc == 3) { ++tc; } if (tc > 1) { ++tc; } temp = y % 100; int td = (temp + temp / 4) % 7; int te = ((20 - tb - tc - td) % 7) + 1; int d = ta + te; if (d > 31) { return new Day(y, Month.April, d - 32); } else { return new Day(y, Month.March, d - 1); } }
Utilities { public static Day easter2(int y) { int firstdig = y / 100; int remain19 = y % 19; int temp = (firstdig - 15) / 2 + 202 - 11 * remain19; if (firstdig == 21 || firstdig == 24 || firstdig == 25 || (firstdig >= 27 && firstdig <= 32) || firstdig == 34 || firstdig == 35 || firstdig == 38) { --temp; } else if (firstdig == 33 || firstdig == 36 || firstdig == 37 || firstdig == 39 || firstdig == 40) { temp -= 2; } temp = temp % 30; int ta = temp + 21; if (temp == 29) { --ta; } if (temp == 28 && remain19 > 10) { --ta; } int tb = (ta - 19) % 7; int tc = (40 - firstdig) % 4; if (tc == 3) { ++tc; } if (tc > 1) { ++tc; } temp = y % 100; int td = (temp + temp / 4) % 7; int te = ((20 - tb - tc - td) % 7) + 1; int d = ta + te; if (d > 31) { return new Day(y, Month.April, d - 32); } else { return new Day(y, Month.March, d - 1); } } }
Utilities { public static Day easter2(int y) { int firstdig = y / 100; int remain19 = y % 19; int temp = (firstdig - 15) / 2 + 202 - 11 * remain19; if (firstdig == 21 || firstdig == 24 || firstdig == 25 || (firstdig >= 27 && firstdig <= 32) || firstdig == 34 || firstdig == 35 || firstdig == 38) { --temp; } else if (firstdig == 33 || firstdig == 36 || firstdig == 37 || firstdig == 39 || firstdig == 40) { temp -= 2; } temp = temp % 30; int ta = temp + 21; if (temp == 29) { --ta; } if (temp == 28 && remain19 > 10) { --ta; } int tb = (ta - 19) % 7; int tc = (40 - firstdig) % 4; if (tc == 3) { ++tc; } if (tc > 1) { ++tc; } temp = y % 100; int td = (temp + temp / 4) % 7; int te = ((20 - tb - tc - td) % 7) + 1; int d = ta + te; if (d > 31) { return new Day(y, Month.April, d - 32); } else { return new Day(y, Month.March, d - 1); } }  }
Utilities { public static Day easter2(int y) { int firstdig = y / 100; int remain19 = y % 19; int temp = (firstdig - 15) / 2 + 202 - 11 * remain19; if (firstdig == 21 || firstdig == 24 || firstdig == 25 || (firstdig >= 27 && firstdig <= 32) || firstdig == 34 || firstdig == 35 || firstdig == 38) { --temp; } else if (firstdig == 33 || firstdig == 36 || firstdig == 37 || firstdig == 39 || firstdig == 40) { temp -= 2; } temp = temp % 30; int ta = temp + 21; if (temp == 29) { --ta; } if (temp == 28 && remain19 > 10) { --ta; } int tb = (ta - 19) % 7; int tc = (40 - firstdig) % 4; if (tc == 3) { ++tc; } if (tc > 1) { ++tc; } temp = y % 100; int td = (temp + temp / 4) % 7; int te = ((20 - tb - tc - td) % 7) + 1; int d = ta + te; if (d > 31) { return new Day(y, Month.April, d - 32); } else { return new Day(y, Month.March, d - 1); } }  static int[] daysCount(TsDomain domain); static int[] daysCount(TsDomain domain, DayOfWeek day); static Day easter(int y); static Day easter2(int y); @Deprecated static Day julianEaster(int year, boolean gregorian); @Deprecated static Day julianEaster2(int year, boolean gregorian); static int julianDate2JDN(int year, int month, int day); static int gregorianDate2JDN(int year, int month, int day); static Day JDN2GregorianDate(int jdn); static Day julianEaster3(int year, boolean gregorian); static Day firstWeekDay(DayOfWeek day, int year, Month month); static int[] lastDay(TsDomain domain); static void leapYear(TsPeriod start, DataBlock buffer); static void lengthofPeriod(TsPeriod start, DataBlock buffer); static double logJacobian(LengthOfPeriodType kind, TsDomain domain,
            boolean back); @Deprecated static int[][] tradingDays(TsDomain domain); static int[][] tdCount(TsDomain domain); static void transform(LengthOfPeriodType kind, TsData tsdata,
            boolean back); static double probJulianEaster(int pos); static double probEaster(int pos); }
Utilities { public static Day easter2(int y) { int firstdig = y / 100; int remain19 = y % 19; int temp = (firstdig - 15) / 2 + 202 - 11 * remain19; if (firstdig == 21 || firstdig == 24 || firstdig == 25 || (firstdig >= 27 && firstdig <= 32) || firstdig == 34 || firstdig == 35 || firstdig == 38) { --temp; } else if (firstdig == 33 || firstdig == 36 || firstdig == 37 || firstdig == 39 || firstdig == 40) { temp -= 2; } temp = temp % 30; int ta = temp + 21; if (temp == 29) { --ta; } if (temp == 28 && remain19 > 10) { --ta; } int tb = (ta - 19) % 7; int tc = (40 - firstdig) % 4; if (tc == 3) { ++tc; } if (tc > 1) { ++tc; } temp = y % 100; int td = (temp + temp / 4) % 7; int te = ((20 - tb - tc - td) % 7) + 1; int d = ta + te; if (d > 31) { return new Day(y, Month.April, d - 32); } else { return new Day(y, Month.March, d - 1); } }  static int[] daysCount(TsDomain domain); static int[] daysCount(TsDomain domain, DayOfWeek day); static Day easter(int y); static Day easter2(int y); @Deprecated static Day julianEaster(int year, boolean gregorian); @Deprecated static Day julianEaster2(int year, boolean gregorian); static int julianDate2JDN(int year, int month, int day); static int gregorianDate2JDN(int year, int month, int day); static Day JDN2GregorianDate(int jdn); static Day julianEaster3(int year, boolean gregorian); static Day firstWeekDay(DayOfWeek day, int year, Month month); static int[] lastDay(TsDomain domain); static void leapYear(TsPeriod start, DataBlock buffer); static void lengthofPeriod(TsPeriod start, DataBlock buffer); static double logJacobian(LengthOfPeriodType kind, TsDomain domain,
            boolean back); @Deprecated static int[][] tradingDays(TsDomain domain); static int[][] tdCount(TsDomain domain); static void transform(LengthOfPeriodType kind, TsData tsdata,
            boolean back); static double probJulianEaster(int pos); static double probEaster(int pos); static final double LUNARY; }