This is a parallel Java version of Sieve of Atkin algorithm optimized for multi-core platforms. Fork-Join framework (see java.util.concurrent) is applied to make full usage of CPU resources. Also, in order to accelerate disk IO, FileChannel and MappedByteBuffer are used to replace old IO classes. Even with BufferedOutputStream, MappedByteBuffer is still 25% faster.
The results are saved to a compact binary file filled with 32-bits integers. The file contains the first 5,761,455 prime numbers. The last one is 99,999,989.
The program totally ran in 1.8 sec including 1.1 sec for prime generation and 0.69 sec for file operations.
Source code's as follows: