java way of testing for primes, thought it was interesting