I'm currently in the process of doing an assignment for one of my class using the BigInteger class. The problem I'm running into is with the .pow method. its giving me this error BigNumberExample1.java:25: error: incompatible types: BigInteger cannot be converted to int BigInteger input4 = (a.pow(b).mod(n));
import java.io.*;
import java.math.*;
class BigNumberExample1{
public static void main (String args[])
{
try
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter number a");
String A = in.readLine();
System.out.println("Enter number b");
String B = in.readLine();
BigInteger a = new BigInteger(A);
BigInteger b = new BigInteger(B);
BigInteger input1 = (a.xor(b));
BigInteger input2 = (a.or(b));
BigInteger input3 = (a.or(b).and(a));
System.out.println("Enter number n");
String N = in.readLine();
BigInteger n = new BigInteger(N);
BigInteger input4 = (a.pow(b).mod(n));
BigInteger input5 = (a.shiftRight(5));
BigInteger input6 = (b.shiftLeft(7));
System.out.println(input1);
System.out.println(input2);
System.out.println(input3);
System.out.println(input4);
System.out.println(input5);
System.out.println(input6);
}
catch (Exception e)
{
e.printStackTrace();
}
}