static int avoidObstacles ( int [ ] obs ) {
  HashSet < Integer > hs = new HashSet < Integer > ( ) ;
  int max = obs [ 0 ] ;
  for ( int i = 0 ;
  i < obs . length ;
  i ++ ) {
    hs . add ( obs [ i ] ) ;
    max = Math . max ( max , obs [ i ] ) ;
  }
  for ( int i = 1 ;
  i <= max ;
  i ++ ) {
    int j ;
    for ( j = i ;
    j <= max ;
    j = j + i ) {
      if ( hs . contains ( j ) ) break ;
    }
    if ( j > max ) return i ;
  }
  return max + 1 ;
}

static int avoidObstacles ( int [ ] obs ) { HashSet < Integer > hs = new HashSet < Integer > ( ) ; int max = obs [ 0 ] ; for ( int i = 0 ; i < obs . length ; i ++ ) { hs . add ( obs [ i ] ) ; max = Math . max ( max , obs [ i ] ) ; } for ( int i = 1 ; i <= max ; i ++ ) { int j ; for ( j = i ; j <= max ; j = j + i ) { if ( hs . contains ( j ) ) break ; } if ( j > max ) return i ; } return max + 1 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (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)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (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: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (for_statement init: (assignment_expression left: (identifier) right: (identifier)) condition: (binary_expression left: (identifier) right: (identifier)) update: (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (break_statement)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (return_statement (identifier))))) (return_statement (binary_expression left: (identifier) right: (decimal_integer_literal)))))