Example of calculating prime numbers with Java.