0
The program doesn't accept big numbers, so i tried using BigInteger, it didn't go well.....i hope someone can put me through.
3 Antworten
0
This worked for me, to get a number loaded at least:
BigInteger bi = new BigInteger("12345");
0
but that only works with values.........i'm trying to store the factorial in a variable and use the variable as the argument. but i'm having errors
0
You have to work all in BigIntegers.
Where you have:
factorial *= i
I believe you need to do this:
factorial = factorial.multiply(new BigInteger(...))
Your new BigInteger is constructed as indicated before, with a string:
Integer.toString(i)
Making:
factorial = factorial.multiply(new BigInteger(Integer.toString(i)));
Here's a site with usage examples for the BigInteger class:
http://javatutorialhq.com/java/math/biginteger-class/