static int maxOnesIndex ( boolean arr [ ] , int n ) {
  int start = 0 ;
  int end = 0 ;
  int maxIndex = - 1 ;
  int lastInd = - 1 ;
  int maxCnt = 0 ;
  while ( end < n ) {
    while ( end < n && arr [ end ] ) {
      end ++ ;
    }
    if ( maxCnt < end - start && lastInd != - 1 ) {
      maxCnt = end - start ;
      maxIndex = lastInd ;
    }
    start = lastInd + 1 ;
    lastInd = end ;
    end ++ ;
  }
  if ( maxCnt < end - start && lastInd != - 1 ) {
    maxCnt = end - start ;
    maxIndex = lastInd ;
  }
  return maxIndex ;
}

static int maxOnesIndex ( boolean arr [ ] , int n ) { int start = 0 ; int end = 0 ; int maxIndex = - 1 ; int lastInd = - 1 ; int maxCnt = 0 ; while ( end < n ) { while ( end < n && arr [ end ] ) { end ++ ; } if ( maxCnt < end - start && lastInd != - 1 ) { maxCnt = end - start ; maxIndex = lastInd ; } start = lastInd + 1 ; lastInd = end ; end ++ ; } if ( maxCnt < end - start && lastInd != - 1 ) { maxCnt = end - start ; maxIndex = lastInd ; } return maxIndex ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (boolean_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))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (array_access array: (identifier) index: (identifier)))) body: (block (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (return_statement (identifier))))