hello I have a problem entering the "m" in the function of ackerman, with the "n" everything is fine, however, entering the value of "m" as a number equal to or greater than 5 marks me error
package ackerman;
import java.util.Scanner;
import java.math.BigInteger;
/**
*
* @author
*/
public class Ackerman {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int m = 0;
int n = 0;
BigInteger result;
Scanner input = new Scanner (System.in);
System.out.println("Introduce m:");
m = Integer.parseInt(input.nextLine());
System.out.println("Introduce m:");
n = Integer.parseInt(input.nextLine());
result = Ackerman(m,n);
System.out.println("Ack(" + m + "," + n + ") = " + result);
}
private static BigInteger Ackerman(long m,long n){
BigInteger res = new BigInteger(String.valueOf(0));
if(m==0){
res = new BigInteger(String.valueOf(n+1));
}
else if(m ==1){
res = new BigInteger(String.valueOf(n+2));
}
else if(m ==2){
res = new BigInteger(String.valueOf((2*n) +3));
}
else if(m ==3){
res = new BigInteger(String.valueOf(Math.round(Math.pow(2, n+3) - 3)));
}
else if(n ==0){
res = Ackerman(m-1,1);
}
else{
res = Ackerman(m-1,Ackerman(m,n-1).longValue());
}
return res;
}
}