class Utilities {

    public static Day easter2(int y) {
        int firstdig = y / 100;
        int remain19 = y % 19;
        // calculate PFM date (Paschal Full Moon)
        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;
        }
        // find the next sunday
        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;
        // return the date
        if (d > 31) {
            return new Day(y, Month.April, d - 32);
        } else {
            return new Day(y, Month.March, d - 1);
        }
    }

}