static int searchStr ( String [ ] arr , String str , int first , int last ) {
  if ( first > last ) return - 1 ;
  int mid = ( last + first ) / 2 ;
  if ( arr [ mid ] . isEmpty ( ) ) {
    int left = mid - 1 ;
    int right = mid + 1 ;
    while ( true ) {
      if ( left < right && right > last ) return - 1 ;
      if ( right <= last && ! arr [ right ] . isEmpty ( ) ) {
        mid = right ;
        break ;
      }
      if ( left >= right && ! arr [ left ] . isEmpty ( ) ) {
        mid = left ;
        break ;
      }
      right ++ ;
      left -- ;
    }
  }
  if ( compareStrings ( str , arr [ mid ] ) == 0 ) return mid ;
  if ( compareStrings ( str , arr [ mid ] ) < 0 ) return searchStr ( arr , str , mid + 1 , last ) ;
  return searchStr ( arr , str , first , mid - 1 ) ;
}

static int searchStr ( String [ ] arr , String str , int first , int last ) { if ( first > last ) return - 1 ; int mid = ( last + first ) / 2 ; if ( arr [ mid ] . isEmpty ( ) ) { int left = mid - 1 ; int right = mid + 1 ; while ( true ) { if ( left < right && right > last ) return - 1 ; if ( right <= last && ! arr [ right ] . isEmpty ( ) ) { mid = right ; break ; } if ( left >= right && ! arr [ left ] . isEmpty ( ) ) { mid = left ; break ; } right ++ ; left -- ; } } if ( compareStrings ( str , arr [ mid ] ) == 0 ) return mid ; if ( compareStrings ( str , arr [ mid ] ) < 0 ) return searchStr ( arr , str , mid + 1 , last ) ; return searchStr ( arr , str , first , mid - 1 ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (return_statement (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (true)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (return_statement (unary_expression operand: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (unary_expression operand: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (break_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (unary_expression operand: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (break_statement))) (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))) right: (decimal_integer_literal))) consequence: (return_statement (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))) right: (decimal_integer_literal))) consequence: (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier))))) (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))))))