public static BigInteger pow(final BigInteger k,long e) throws MathIllegalArgumentException {
  if (e < 0) {
    throw new MathIllegalArgumentException(LocalizedCoreFormats.EXPONENT,e);
  }
  BigInteger result=BigInteger.ONE;
  BigInteger k2p=k;
  while (e != 0) {
    if ((e & 0x1) != 0) {
      result=result.multiply(k2p);
    }
    k2p=k2p.multiply(k2p);
    e>>=1;
  }
  return result;
}

public static BigInteger pow ( final BigInteger k , long e ) throws MathIllegalArgumentException { if ( e < 0 ) { throw new MathIllegalArgumentException ( LocalizedCoreFormats . EXPONENT , e ) ; } BigInteger result = BigInteger . ONE ; BigInteger k2p = k ; while ( e != 0 ) { if ( ( e & 0x1 ) != 0 ) { result = result . multiply ( k2p ) ; } k2p = k2p . multiply ( k2p ) ; e >>= 1 ; } return result ; }
raise a biginteger to a long power .
