private static int firstIslamicStartYearFromGrego ( int year ) { // ad hoc conversion, improve under #10752 // rough est for now, ok for grego 1846-2138, // otherwise occasionally wrong (for 3% of years) int cycle , offset , shift = 0 ; if ( year >= 1977 ) { cycle = ( year - 1977 ) / 65 ; offset = ( year - 1977 ) % 65 ; shift = 2 * cycle + ( ( offset >= 32 ) ? 1 : 0 ) ; } else { cycle = ( year - 1976 ) / 65 - 1 ; offset = - ( year - 1976 ) % 65 ; shift = 2 * cycle + ( ( offset <= 32 ) ? 1 : 0 ) ; } return year - 579 + shift ; }
utility function for setRelatedYear