Infinite Loop During Calculation of Power of Big Integers Java
问题 I have been staring at this code and cannot figure out what is wrong with it, maybe a fresh pair of eyes could help. public static BigInteger powerOfBigInteger (BigInteger base, BigInteger power){ if (power == BigInteger.valueOf(0)){ return BigInteger.valueOf(1); } if (power == BigInteger.valueOf(1)){ return base; } BigInteger x = BigInteger.valueOf(1); while (x != power ){ base.multiply(base); x.add(BigInteger.valueOf(1)); System.out.println(x + " " + power); return base; } return base; I