b.add(c).multiply(a).add(d)
If the variables were int
this would be
(b+c)*a + d
divide()
divide()
works as expected. Look out for division by zero.
public BigInteger divide( BigInteger val )
Integer divide theBigInteger
that contains the method byval
. The result is returned in a newBigInteger
. Ifval
is zero, throw anArithmeticException
.
BigInteger a = new BigInteger( "36" ); BigInteger b = new BigInteger( "10" ); BigInteger c = new BigInteger( "6" ); BigInteger z = BigInteger.ZERO;
What is the result of each of the following?