public static int binarySearch ( int a [ ] , int n ) {
  int i = 0 , j = a . length - 1 ;
  int k ;
  while ( true ) {
    k = ( i + j ) / 2 ;
    if ( k < n - 1 && n < a [ k + 1 ] && n > a [ k ] ) {
      return k ;
    }
    if ( k > 0 && a [ k - 1 ] > n ) j = k - 1 ;
    if ( a [ k ] < n ) i = k + 1 ;
  }
}

public static int binarySearch ( int a [ ] , int n ) { int i = 0 , j = a . length - 1 ; int k ; while ( true ) { k = ( i + j ) / 2 ; if ( k < n - 1 && n < a [ k + 1 ] && n > a [ k ] ) { return k ; } if ( k > 0 && a [ k - 1 ] > n ) j = k - 1 ; if ( a [ k ] < n ) i = k + 1 ; } }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (while_statement condition: (parenthesized_expression (true)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) consequence: (block (return_statement (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))))))