package org.psjava.algo.math.numbertheory;

import java.util.Arrays;

public class SieveOfEratosthenes {

	public static PrimeNumberSieve getInstance() {
		return new PrimeNumberSieve() {
			@Override
			public boolean[] calcPrimeMap(int limit) {
				boolean[] prime = new boolean[limit + 1];
				Arrays.fill(prime, true);
				prime[0] = false;
				prime[1] = false;
				for (int i = 2; i <= limit; i++)
					if (prime[i])
						for (int j = i + i; j <= limit; j += i)
							prime[j] = false;
				return prime;
			}
		};
	}

}

@@ -99,16 +99,131 @@
 enes %7B%0A%0A
+%09/**%0A%09 * Implementation of Sieve of Eratosthenes%0A%09 * %0A%09 * http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes%0A%09 */%0A%0A
 %09public 

improve comment