Here you can find the source of modPowLong(BigInteger n, long exponent, BigInteger modulo)
private static long modPowLong(BigInteger n, long exponent, BigInteger modulo)
//package com.java2s; //License from project: Apache License import java.math.BigInteger; public class Main { private static long modPowLong(BigInteger n, long exponent, BigInteger modulo) { return n.modPow(BigInteger.valueOf(exponent), modulo).longValue(); }/*from w w w . j ava 2s .co m*/ }