title: How to create array of size greater than integer max
body: <p>I was trying to get all primes before 600851475143.
  I was using Sieve of Eratosthenes for this.
  This requires me to create a boolean array of that huge size.
  Bad idea, you can run out of memory.
  Any other way. I tried using a string, using each index with values 0 &amp; 1 to represent true or false. but indexOf method too returns int.</p>
  
  <p>Next i am using 2d array for my problem. 
  Any other better way to store such a huge array?</p>