static ArrayList < Integer > SieveOfEratosthenes ( ) {
  for ( int a = 0 ;
  a < isprime . length ;
  a ++ ) {
    isprime [ a ] = true ;
  }
  for ( int p = 2 ;
  p * p < N ;
  p ++ ) {
    if ( isprime [ p ] == true ) {
      for ( int i = p * p ;
      i < N ;
      i += p ) isprime [ i ] = false ;
    }
  }
  ArrayList < Integer > primes = new ArrayList < Integer > ( ) ;
  for ( int i = 2 ;
  i < N ;
  i ++ ) if ( isprime [ i ] ) primes . add ( i ) ;
  return primes ;
}

static ArrayList < Integer > SieveOfEratosthenes ( ) { for ( int a = 0 ; a < isprime . length ; a ++ ) { isprime [ a ] = true ; } for ( int p = 2 ; p * p < N ; p ++ ) { if ( isprime [ p ] == true ) { for ( int i = p * p ; i < N ; i += p ) isprime [ i ] = false ; } } ArrayList < Integer > primes = new ArrayList < Integer > ( ) ; for ( int i = 2 ; i < N ; i ++ ) if ( isprime [ i ] ) primes . add ( i ) ; return primes ; }
(method_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier) parameters: (formal_parameters) body: (block (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 (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (true))))) (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: (array_access array: (identifier) index: (identifier)) right: (true))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (assignment_expression left: (identifier) right: (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (false)))))))) (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: (if_statement condition: (parenthesized_expression (array_access array: (identifier) index: (identifier))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (return_statement (identifier))))