public static void primeGen() {
		// prepare array
	    for(int i=0; i<max; i++) numberPool[i]=false;
	    // tick off 0 and 1, so that following loops are simpler
	    numberPool[0]=true;
	    numberPool[1]=true;
	    
	    // NB: in numberPool the false numbers end up being prime
	    for(int i=0; i<max; ++i) {
	    	int num=0, incr=0;	// num will be incremented by incr
	        
	        // if we find a prime, start marking the non-primes
	        if(!numberPool[i]) {   // if number is a prime
	            num=i;            // use it as our base
	            for(int j=0; j<max; ++j) {
	                
	                if(incr==0) {  // add p just in the beginning
	                    incr+=num;   // otherwise prime would be overwritten
	                }
	                
	                incr+=num;
	                if(incr<max) {
	                	numberPool[incr] = true;
	                }
	            }
	        }
	    }
	    
	    // fill prime array
	    for(int i=0; i<max; i++) {
	    	if(!numberPool[i]) {	
	    		primePool.add(i);
	        }
	    }
	}