static Set < Integer > AMICABLE ( ) {
  int sum [ ] = new int [ N ] ;
  for ( int i = 0 ;
  i < N ;
  i ++ ) sum [ i ] = 0 ;
  for ( int i = 1 ;
  i < N ;
  i ++ ) {
    sum [ i ] ++ ;
    for ( int j = 2 ;
    j * j <= i ;
    j ++ ) {
      if ( i % j == 0 ) {
        sum [ i ] += j ;
        if ( i / j != j ) sum [ i ] += i / j ;
      }
    }
  }
  Set < Integer > s = new HashSet < Integer > ( ) ;
  for ( int i = 2 ;
  i < N ;
  i ++ ) {
    if ( i != sum [ i ] && sum [ i ] < N && i == sum [ sum [ i ] ] ) {
      s . add ( i ) ;
      s . add ( sum [ i ] ) ;
    }
  }
  return s ;
}

static Set < Integer > AMICABLE ( ) { int sum [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) sum [ i ] = 0 ; for ( int i = 1 ; i < N ; i ++ ) { sum [ i ] ++ ; for ( int j = 2 ; j * j <= i ; j ++ ) { if ( i % j == 0 ) { sum [ i ] += j ; if ( i / j != j ) sum [ i ] += i / j ; } } } Set < Integer > s = new HashSet < Integer > ( ) ; for ( int i = 2 ; i < N ; i ++ ) { if ( i != sum [ i ] && sum [ i ] < N && i == sum [ sum [ i ] ] ) { s . add ( i ) ; s . add ( sum [ i ] ) ; } } return s ; }
(method_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (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 (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (identifier) right: (identifier))))))))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list)))) (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: (binary_expression left: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier)))))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))))))) (return_statement (identifier))))