You'll have to convert everything to a BigInteger, then use the compareTo method.
However, I would strongly advise
against writing a naive primality test for BigInteger numbers. There are much faster statistical methods for checking if a number is prime.
One of these is built into the BigInteger class:
isProbablyPrime.
There is also another method I implemented
here. This uses a "better" method for checking if a number is prime for twice the statistical accuracy. This is because this test always reports composite numbers as composite and prime numbers as probably prime, but the built-in method reports both probably prime and probably composite.