Space and time efficient Algorithm for generating prime numbers
Coding style

First, let me comment on your coding style / readability:

NonPrimeNumbers does not follow Java Naming Conventions. Local variables should start with lower case.

Your variable names are simply bad. 


i is the candidate prime number, so its name should reflect that, e.g. candidatePrime.
k should become arrayIndex (as you did when printing the results).
j should become multiple.
When finding the primes, you should also use the variable name bitPosition instead of (i&gt;&gt;1)%32.


Don't reuse variables for two different meanings, as you did with range. Use two different ones, e.g. primesRange and arrayRange.

At mostly all places where you added comments, introduce method calls instead of one big ugly main() method.


(NonPrimeNumbers[k]&amp;(1&lt;&lt;(i&gt;&gt;1)))==0 then should read isPrime(candidatePrime) or isPrime(arrayIndex,bitPosition).
NonPrimeNumbers[j&gt;&gt;6]|=1&lt;&lt;(j&gt;&gt;1) should become setNonPrime(multiple).
and so on.


Of course, NonPrimeNumbers then has to become an instance field instead of a local var.

Performance

You seem to be looking for performance. I won't do a detailed profiling of your program, that task is up to you. But you can check some modifications that might speed up your program (esp. for bigger prime numbers):

Instead of the single for(int i=3;i*i &lt;= range;i+=2) loop you could try two nested loops, with an intermediate check if a prime number is possible:

for (int arrayIndex=0; arrayIndex&lt;arrayRange; arrayIndex++) {
    if (nonPrimeNumbers[arrayIndex] != 0xffffffff) {
        for (int bitPosition = 0, pattern = 1; 
             bitPosition &lt; 32; 
             bitPosition++, pattern &lt;&lt;= 1) {
            ...
        }
    }
}


Maybe you can mostly do without the candidatePrime variable, just with arrayIndex and bitPosition, only using it when you found a prime.

You have to try what gives you the best performance...