Is there anyway to convert from double
value to BigInteger
?
double doubleValue = 64654679846513164.2;
BigInteger bigInteger = (BigInteger) doubleValue;
I try to cast it but it didn't work.
You can convert the double into a BigDecimal
and then into a BigInteger
:
BigInteger k = BigDecimal.valueOf(doublevalue).toBigInteger();