static int getYearLength ( int year ) { int cycleNumber = ( year - 1 ) / 30 ; Integer [ ] cycleYears ; try { cycleYears = ADJUSTED_CYCLE_YEARS . get ( cycleNumber ) ; } catch ( ArrayIndexOutOfBoundsException e ) { cycleYears = null ; } if ( cycleYears != null ) { int yearInCycle = ( year - 1 ) % 30 ; if ( yearInCycle == 29 ) { return ADJUSTED_CYCLES [ cycleNumber + 1 ] . intValue ( ) - ADJUSTED_CYCLES [ cycleNumber ] . intValue ( ) - cycleYears [ yearInCycle ] . intValue ( ) ; } return cycleYears [ yearInCycle + 1 ] . intValue ( ) - cycleYears [ yearInCycle ] . intValue ( ) ; } else { return isLeapYear ( year ) ? 355 : 354 ; } }
Returns year length .