Instead
if (x == BigInteger.ZERO || x == BigInteger.ONE) { return x;
You must use: -
if (x.equals(BigInteger.ZERO) || x.equals(BigInteger.ONE)){ return x;
In addition, you must first change Integer to BigInteger, and then compare as Joe pointed out in your answer:
Integer a=3; if(BigInteger.valueOf(a).compareTo(BigInteger.TEN)<0){
source share