BigInteger b = BigInteger.valueOf(calcFib(Integer.parseInt(args[0])));
I try to run this to create a new BigInteger for a large Fibonacci number, but whenever I do, this error gets thrown:
error: cannot find symbol
BigInteger b = BigInteger.valueOf(calcFib(Integer.parseInt(args[0])));
^
symbol: class BigInteger
location: class FibonacciCalculator
I've imported java.lang.Object if that helps. Am still new to programming so please don't judge :P
Edit: the original is done in main, however now I'm getting a new problem with this line of code after importing java.math.BigInteger
public static BigInteger calcFib (int n)
{
if(n == 1 || n == 2)
return 1;
else
{
return calcFib(n-1) + calcFib(n-2);
}
}
both parts of the if/else statements throw errors, the if says int can 't be converted to BigInteger, and the else says bad operand types. Again sorry for my ignorance and thanks for the help!