I'm wondering is there a way to change a BigInteger variable's value to another BigInteger's value? It seems like 'BigInteger.valueOf' doesn't accept other BigIntegers as its value and neither does 'new BigInteger'.
I didn't read your question carefully enough.
I'm wondering is there a way to change a BigInteger variable's value to another BigInteger's value
No, since BigInteger is immutable.
However, you can create a new BigInteger instance that would have the same value as the original :
One way is to convert to String and construct the copy from that String :
BigInteger source = ...
BigInteger target = new BigInteger (source.toString());
Another way is to use the byte array :
BigInteger target = new BigInteger (source.toByteArray());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With