Sieve of eratosthenes problem java
<p>I am trying to make sieve of eratosthenes, i am currently having a problem.
The probelm is that during the calculation method, the program won't continue to the next prime number.
I think the problem is with the while loop but i don't know how to fix it. Can someone help me?</p>

<p>Thank you</p>

<pre><code>import java.util.*;
import java.io.*;

public class Primes_below_N {

    static Vector&lt;Integer&gt; numbers = new Vector&lt;Integer&gt;();
    static BufferedReader br = new BufferedReader(new InputStreamReader(
            System.in));

    public static void main(String[] args) throws IOException {
        System.out.print("Please enter a number: ");
        int LIMIT = Integer.parseInt(br.readLine());
        populate(LIMIT);
        calculatePrimes(LIMIT);
        print(numbers);

    }

    // populate a 'numbers' with a numbers upto limit
    public static void populate(int limit) {
        for (int i = 1; i &lt;= limit; i++) {
            numbers.add(i);
        }
    }

    // calculate prime numbers
    public static void calculatePrimes(int limit) {
        int p = 2;
        int nextPrime = 1;
        while (Math.pow(p, 2) &lt; limit) {
            for (int i = 0; i &lt; numbers.size(); ++i) {
                if (numbers.get(i) % 2 == 0 &amp;&amp; numbers.get(i) != i) {
                    numbers.remove(i);
                }
            }
            p = numbers.get(nextPrime);
            nextPrime += 1;
        }
    }

    public static void print(Vector&lt;Integer&gt; list) {
        for (int i : list) {
            System.out.println(i);
        }
    }

}
</code></pre>
