static int findTransitionPoint ( int arr [ ] , int n ) {
  int lb = 0 , ub = n - 1 ;
  while ( lb <= ub ) {
    int mid = ( lb + ub ) / 2 ;
    if ( arr [ mid ] == 0 ) lb = mid + 1 ;
    else if ( arr [ mid ] == 1 ) {
      if ( arr [ mid - 1 ] == 0 ) return mid ;
      ub = mid - 1 ;
    }
  }
  return - 1 ;
}

static int findTransitionPoint ( int arr [ ] , int n ) { int lb = 0 , ub = n - 1 ; while ( lb <= ub ) { int mid = ( lb + ub ) / 2 ; if ( arr [ mid ] == 0 ) lb = mid + 1 ; else if ( arr [ mid ] == 1 ) { if ( arr [ mid - 1 ] == 0 ) return mid ; ub = mid - 1 ; } } return - 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: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (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 (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) consequence: (return_statement (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))) (return_statement (unary_expression operand: (decimal_integer_literal)))))