static ArrayList < Integer > seive ( int n ) {
  ArrayList < Integer > prime = new ArrayList < Integer > ( ) ;
  for ( int i = 0 ;
  i < n + 1 ;
  i ++ ) prime . add ( 0 ) ;
  int p = 2 ;
  while ( p * p <= n ) {
    if ( prime . get ( p ) == 0 ) {
      for ( int i = 2 * p ;
      i < n + 1 ;
      i += p ) prime . set ( i , 1 ) ;
    }
    p += 1 ;
  }
  ArrayList < Integer > allPrimes = new ArrayList < Integer > ( ) ;
  for ( int i = 2 ;
  i < n ;
  i ++ ) {
    if ( prime . get ( i ) == 0 ) allPrimes . add ( i ) ;
  }
  return allPrimes ;
}

static ArrayList < Integer > seive ( int n ) { ArrayList < Integer > prime = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n + 1 ; i ++ ) prime . add ( 0 ) ; int p = 2 ; while ( p * p <= n ) { if ( prime . get ( p ) == 0 ) { for ( int i = 2 * p ; i < n + 1 ; i += p ) prime . set ( i , 1 ) ; } p += 1 ; } ArrayList < Integer > allPrimes = new ArrayList < Integer > ( ) ; for ( int i = 2 ; i < n ; i ++ ) { if ( prime . get ( i ) == 0 ) allPrimes . add ( i ) ; } return allPrimes ; }
(method_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) 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)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (decimal_integer_literal) right: (identifier)))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (assignment_expression left: (identifier) right: (identifier)) body: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) (return_statement (identifier))))