private static int search ( long utcDays , long [ ] firstOfMonth ) { int low = 0 ; int high = firstOfMonth . length - 1 ; while ( low <= high ) { int middle = ( low + high ) / 2 ; if ( firstOfMonth [ middle ] <= utcDays ) { low = middle + 1 ; } else { high = middle - 1 ; } } return low - 1 ; }
returns index of month - start associated with utcDays