I have been looking through the Math
library but I cannot seem to find a method that will double a number and return it.
I need something that will do num+=num
Of course the above will work but once the numbers get large, it no longer does what I need, even if I use a long
instead of an int
.
Or is it perhaps the data type rather than a method that I need to change?
I found a solution.
BigInteger num = new BigInteger("1");
num = num.add(num);
When reading about BigInteger
it said it was immutable so I took that as not being able to change the value. I think I need a better understanding of immutable.