public static long millisToYearStart ( int year ) { // Calculate how many leap years elapsed prior to the year in question. int leapYears = year / 100 ; if ( year < 0 ) { leapYears = ( ( year + 3 ) >> 2 ) - leapYears + ( ( leapYears + 3 ) >> 2 ) - 1 ; } else { leapYears = ( year >> 2 ) - leapYears + ( leapYears >> 2 ) ; if ( isLeapYear ( year ) ) { leapYears -- ; } } return ( ( year * 365L ) + leapYears - DAYS_TO_1970 ) * MILLIS_PER_DAY ; }
Calculates the number of milliseconds to the start of the specified year taking 1970 as zero .