Is it possible to do +- operations like this somehow?
BigInteger a = new BigInteger("1");
BigInteger b = new BigInteger("2");
BigInteger result;
a+=b;
//result = a.add(b);
Unfortunately not. Operator overloading is not supported in the Java language. The syntax only works for the other numeric primitive wrappers via auto-boxing, which wouldn't make sense for BigInteger as there's no equivalent primitive.
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