I'm developing a chemistry app, and I need to include the Avogadro's number:
(602200000000000000000000
)
I don't really know if I can use scientific notation to represent it as 6.022 x 10x23
(can't put the exponent).
I first used double
, then long
and now, I used java.math.BigInteger
.
But it still says it's too big, what can I do or should this is just to much for a system?
Pass it to the BigInteger constructor as a String
, and it works just fine.
BigInteger a = new BigInteger("602200000000000000000000");
a = a.multiply(new BigInteger("2"));
System.out.println(a);
Output: 1204400000000000000000000
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