I have to get in java protected final static int [] SIEVE = new int [ 1 << 32 ];
But i cant force java to that.
Max sieve what i get is 2^26 i need 2^32 to end my homework. I tried with mask but i need to have SIEVE[n] = k where min{k: k|n & k >2}.
EDIT
I need to find Factor numbers from 2 to 2^63-1 using Sieve and sieve must have information that P[n]= is smallest prime with divide n. I know that with sieve i can Factorise number to 2^52. But how do that exercises with holding on to the content.
EDIT x2 problem solved
If you really need to store that much data in memory, try using java.util.LinkedList collection instead.
However, there’s a fundamental flaw in your algorithm if you need to store 16GB of data in memory.
If you’re talking about Sieve of Eratosthenes and you need to store all primes < 2^32 in an array, you still wouldn’t need an array of size 2^32. I’d suggest you use
java.util.BitSetto find the primes and either iterate and print or store them in a LinkedList as required.