I am creating a small game for students, and in a place, it has to display the value of 27830457+1
I can call BigInteger’s pow() method if the number is not this much big. Since the number is very big, that method is useless. How can I find the HUGE power of this kind of numbers? Please help!
I don’t know why you think
BigIntegerisn’t up to this:It takes a little while (particularly the string conversion at the end), but it’s perfectly reasonable.
As Peter noted, shifting
ONEleft 7830457 is much neater, mind you. I’d argue it’s a bit less clear – and of course it doesn’t help in the string conversion part.EDIT: Almost all of the time is spent in the string conversion. It finished in the end on my box though. I can’t see the start of it any more, but it ends with…