static void getNumbers ( int a [ ] , int n ) {
  HashMap < Integer , Integer > freq = new HashMap < Integer , Integer > ( ) ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) if ( freq . containsKey ( a [ i ] ) ) {
    freq . put ( a [ i ] , freq . get ( a [ i ] ) + 1 ) ;
  }
  else {
    freq . put ( a [ i ] , 1 ) ;
  }
  int maxi1 = Arrays . stream ( a ) . max ( ) . getAsInt ( ) ;
  for ( int i = 1 ;
  i * i <= maxi1 ;
  i ++ ) {
    if ( maxi1 % i == 0 && freq . containsKey ( i ) && freq . get ( i ) != 0 ) {
      freq . put ( i , freq . get ( i ) - 1 ) ;
      if ( i != ( maxi1 / i ) && freq . containsKey ( maxi1 / i ) && freq . get ( maxi1 / i ) != 0 ) freq . put ( maxi1 / i , freq . get ( maxi1 / i ) - 1 ) ;
    }
  }
  int maxi2 = - 1 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    if ( freq . get ( a [ i ] ) != 0 ) maxi2 = Math . max ( maxi2 , a [ i ] ) ;
  }
  System . out . print ( maxi1 + " " + maxi2 ) ;
}

static void getNumbers ( int a [ ] , int n ) { HashMap < Integer , Integer > freq = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) if ( freq . containsKey ( a [ i ] ) ) { freq . put ( a [ i ] , freq . get ( a [ i ] ) + 1 ) ; } else { freq . put ( a [ i ] , 1 ) ; } int maxi1 = Arrays . stream ( a ) . max ( ) . getAsInt ( ) ; for ( int i = 1 ; i * i <= maxi1 ; i ++ ) { if ( maxi1 % i == 0 && freq . containsKey ( i ) && freq . get ( i ) != 0 ) { freq . put ( i , freq . get ( i ) - 1 ) ; if ( i != ( maxi1 / i ) && freq . containsKey ( maxi1 / i ) && freq . get ( maxi1 / i ) != 0 ) freq . put ( maxi1 / i , freq . get ( maxi1 / i ) - 1 ) ; } } int maxi2 = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( freq . get ( a [ i ] ) != 0 ) maxi2 = Math . max ( maxi2 , a [ i ] ) ; } System . out . print ( maxi1 + " ▁ " + maxi2 ) ; }
(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: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier) (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: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))) right: (decimal_integer_literal)))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (decimal_integer_literal))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list)) name: (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: (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: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))) right: (decimal_integer_literal)))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))) right: (decimal_integer_literal)))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)))))))