rewrite the Primes class, tested working in normal Java

stilll doesn't work on J--