static void getLongestSeq ( int a [ ] , int n ) {
  int maxIdx = 0 , maxLen = 0 , currLen = 0 , currIdx = 0 ;
  for ( int k = 0 ;
  k < n ;
  k ++ ) {
    if ( a [ k ] > 0 ) {
      currLen ++ ;
      if ( currLen == 1 ) currIdx = k ;
    }
    else {
      if ( currLen > maxLen ) {
        maxLen = currLen ;
        maxIdx = currIdx ;
      }
      currLen = 0 ;
    }
  }
  if ( maxLen > 0 ) {
    System . out . print ( "Length " + maxLen ) ;
    System . out . print ( ",starting index " + maxIdx ) ;
  }
  else System . out . println ( "No positive sequence detected." ) ;
  return ;
}

static void getLongestSeq ( int a [ ] , int n ) { int maxIdx = 0 , maxLen = 0 , currLen = 0 , currIdx = 0 ; for ( int k = 0 ; k < n ; k ++ ) { if ( a [ k ] > 0 ) { currLen ++ ; if ( currLen == 1 ) currIdx = k ; } else { if ( currLen > maxLen ) { maxLen = currLen ; maxIdx = currIdx ; } currLen = 0 ; } } if ( maxLen > 0 ) { System . out . print ( " Length ▁ " + maxLen ) ; System . out . print ( " , starting ▁ index ▁ " + maxIdx ) ; } else System . out . println ( " No ▁ positive ▁ sequence ▁ detected . " ) ; return ; }
(method_declaration (modifiers) type: (void_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: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier))))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (string_literal) right: (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (string_literal) right: (identifier)))))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) (return_statement)))