loop taking some time and resulting wrong value; first n prime : <p>I'm trying to write a method that gives the collection of first n prime numbers. I googled and many of my code is similar to the ones I found online. but my loop takes long time and print 2, 0 
Here's my code </p>

<pre><code>public static boolean isPrime(int numb) {
        if(numb &lt; 0) {
            return false;
        }
        for(int i = 2; i &lt; numb; i++) {
            if((numb % i) != 0) {
                return false;
            }
        }
        return true;

    }

    public static int[] firstPrimeNumbers(int n) {
        int[] pNumbs = new int[n];
        int count = 0;
        int number = 2;
        while(count != n) {
            if(isPrime(number)) {
                pNumbs[count] = number;
                count++;
            }
            number++;
        }
        return pNumbs;
    }




public static void main(String[] args) {

    int[] a = firstPrimeNumbers(2);
    for(int x: a) {
        System.out.println(x);
    }
}
</code></pre>
