long calculateFirstDayOfYearMillis(int year) {
        // Java epoch is 1970-01-01 Gregorian which is 1686-04-23 Coptic.
        // Calculate relative to the nearest leap year and account for the
        // difference later.

        int relativeYear = year - 1687;
        int leapYears;
        if (relativeYear <= 0) {
            // Add 3 before shifting right since /4 and >>2 behave differently
            // on negative numbers.
            leapYears = (relativeYear + 3) >> 2;
        } else {
            leapYears = relativeYear >> 2;
            // For post 1687 an adjustment is needed as jan1st is before leap day
            if (!isLeapYear(year)) {
                leapYears++;
            }
        }
        
        long millis = (relativeYear * 365L + leapYears)
            * (long)DateTimeConstants.MILLIS_PER_DAY;

        // Adjust to account for difference between 1687-01-01 and 1686-04-23.

        return millis + (365L - 112) * DateTimeConstants.MILLIS_PER_DAY;
    }
long calculateFirstDayOfYearMillis ( int year ) { int relativeYear = year - 1687 ; int leapYears ; if ( relativeYear <= 0 ) { leapYears = ( relativeYear + 3 ) > > 2 ; } else { leapYears = relativeYear > > 2 ; if ( ! isLeapYear ( year ) ) { leapYears ++ ; } } long millis = ( relativeYear * 365L + leapYears ) * ( long ) DateTimeConstants . MILLIS_PER_DAY ; return millis + ( 365L - 112 ) * DateTimeConstants . MILLIS_PER_DAY ; }
-----------------------------------------------------------------------