@@ -0,0 +1,1556 @@
+/**%0A */%0Apublic class TheSieveOfEratosthenes %7B%0A%0A    public static final int CONCURRENCY = 20;%0A    public static final int SIZE = 16 * 1024 * 1024;%0A    public static final int SQRT_SIZE = (int) Math.sqrt(SIZE);%0A%0A    /**%0A     * l1-dcache-store-misses%0A     *%0A     * @return%0A     */%0A    public static boolean%5B%5D alwaysWrite() %7B%0A%0A        boolean%5B%5D s = new boolean%5BSIZE%5D;%0A%0A        for (int i = 2; i %3C= SQRT_SIZE; i++) %7B%0A            if (!s%5Bi%5D) %7B%0A                for (int j = i * i; j %3C SIZE; j += i) %7B%0A                    s%5Bj%5D = true;%0A                %7D%0A            %7D%0A        %7D%0A%0A        return s;%0A    %7D%0A%0A%0A    public static boolean%5B%5D testAndWrite() %7B%0A%0A        boolean%5B%5D s = new boolean%5BSIZE%5D;%0A%0A        for (int i = 2; i %3C= SQRT_SIZE; i++) %7B%0A            if (!s%5Bi%5D) %7B%0A                for (int j = i * i; j %3C SIZE; j += i) %7B%0A                    if (!s%5Bj%5D) %7B%0A                        s%5Bj%5D = true;%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A%0A        return s;%0A    %7D%0A%0A    public static void startThreads(Runnable task) %7B%0A%0A        for (int i = 0; i %3C CONCURRENCY; i++) %7B%0A            new Thread(task).start();%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        Runnable alwaysWriteTask = () -%3E %7B%0A            while (true) %7B%0A                TheSieveOfEratosthenes.alwaysWrite();%0A            %7D%0A        %7D;%0A%0A        Runnable testAndWrite = () -%3E %7B%0A            while (true) %7B%0A                TheSieveOfEratosthenes.testAndWrite();%0A            %7D%0A        %7D;%0A%0A        startThreads(alwaysWriteTask);%0A        startThreads(testAndWrite);%0A%0A    %7D%0A%7D%0A

Add The Sieve Of Eratosthenes example