static int maximumPoints ( int arr [ ] , int n , int k , int i ) {
  int start ;
  if ( k > i ) start = 0 ;
  else start = i - k ;
  int res = 0 ;
  for ( int j = start ;
  j <= start + k && j < n ;
  j ++ ) res += arr [ j ] ;
  int curr_sum = res ;
  for ( int j = start + k + 1 ;
  j < n && j <= i + k ;
  j ++ ) {
    curr_sum += arr [ j ] - arr [ j - k - 1 ] ;
    res = Math . max ( res , curr_sum ) ;
  }
  return res ;
}

static int maximumPoints ( int arr [ ] , int n , int k , int i ) { int start ; if ( k > i ) start = 0 ; else start = i - k ; int res = 0 ; for ( int j = start ; j <= start + k && j < n ; j ++ ) res += arr [ j ] ; int curr_sum = res ; for ( int j = start + k + 1 ; j < n && j <= i + k ; j ++ ) { curr_sum += arr [ j ] - arr [ j - k - 1 ] ; res = Math . max ( res , curr_sum ) ; } return res ; }
(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)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) alternative: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (identifier))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) condition: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))) (return_statement (identifier))))