private long yearToDayOfEpoch ( long year ) { if ( year > 0 ) { year -= 1601 ; return ( 365 * year + year / 4 - year / 100 + year / 400 - ( ( 1970 - 1601 ) * 365 + ( 1970 - 1601 ) / 4 - 3 ) ) ; } else { year = 2000 - year ; return ( ( 2000 - 1970 ) * 365 + ( 2000 - 1970 ) / 4 - ( 365 * year + year / 4 - year / 100 + year / 400 ) ) ; } }
Based on the year return the number of days since the epoch .