question: private static int indexOf ( Object o , Object [ ] elements , int index , int fence ) { if ( o == null ) { for ( int i = index ; i < fence ; i ++ ) if ( elements [ i ] == null ) return i ; } else { for ( int i = index ; i < fence ; i ++ ) if ( o . equals ( elements [ i ] ) ) return i ; } return - 1 ; }
target:  static version of indexOf, to allow repeated calls without needing to re-acquire array each time.