static Boolean areConsecutives ( int arr [ ] , int n ) {
  int first_term = Integer . MAX_VALUE ;
  for ( int j = 0 ;
  j < n ;
  j ++ ) {
    if ( arr [ j ] < first_term ) first_term = arr [ j ] ;
  }
  int ap_sum = ( n * ( 2 * first_term + ( n - 1 ) * 1 ) ) / 2 ;
  int arr_sum = 0 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) arr_sum += arr [ i ] ;
  return ap_sum == arr_sum ;
}

static Boolean areConsecutives ( int arr [ ] , int n ) { int first_term = Integer . MAX_VALUE ; for ( int j = 0 ; j < n ; j ++ ) { if ( arr [ j ] < first_term ) first_term = arr [ j ] ; } int ap_sum = ( n * ( 2 * first_term + ( n - 1 ) * 1 ) ) / 2 ; int arr_sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) arr_sum += arr [ i ] ; return ap_sum == arr_sum ; }
(method_declaration (modifiers) type: (type_identifier) 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: (field_access object: (identifier) field: (identifier)))) (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: (identifier))) consequence: (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: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))))) right: (decimal_integer_literal)))) (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: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (return_statement (binary_expression left: (identifier) right: (identifier)))))