I am trying to initialise an array of boolean type whose size is a 10 digit integer. It keeps on throwing OutOfMemoryException. I have increased the size of the heap space of eclipse to 1024 from 256. Is there anything that I am missing to do?
int size = 1000000000;
boolean[] primesList = new boolean[size];
When starting the JVM you need to pass a -Xmx parameter to set the maximum heap space as higher.
Also note that arrays have a maximum size of Integer.MAX_VALUE