Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerModPowExample3 { public static void main(String[] args) { //create 4 BigInteger objects BigInteger big1,big2,exp,result; // initialize all BigInteger objects big1=new BigInteger("13"); big2=new BigInteger("5"); exp=new BigInteger("-2"); //perform modPow operation on big1 using big2 and exp result=big1.modPow(exp,big2); String str=big1+"^"+exp+" mod "+big2+" is "+result; System.out.println(str); } }
Output