+ 2

How to perform arithmetic operations between a BigInteger and a normal integer?

2nd Feb 2018, 5:01 PM
Suhail Pappu
Suhail Pappu - avatar
6 Answers
+ 2
try using BigInteger.valueOf(yourInt)
2nd Feb 2018, 5:27 PM
michal
+ 2
bigint1.add(bigint2) bigint1.divide(bigint2) bigint1.multiply(bigint2) bigint1.subtract(bigint2) see https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html
2nd Feb 2018, 5:34 PM
michal
+ 2
to sum up: bigint1.add(BigInteger.valueOf(yourInt))
2nd Feb 2018, 8:35 PM
michal
+ 1
yea but i am asking about the arithmetic operations :)
2nd Feb 2018, 5:30 PM
Suhail Pappu
Suhail Pappu - avatar
+ 1
that is with two big ints ...i am saying about one bigint and a normal int
2nd Feb 2018, 6:10 PM
Suhail Pappu
Suhail Pappu - avatar