Java | Summation of primes