Code example for BigInteger

Methods: modPow

0
		byte eBytes[] = {1, 2, 3, 4, 5};
		byte mBytes[] = {1, 2, 3};
		int aSign = 1;
		int eSign = 1;		
		int mSign = -1;		
		BigInteger aNumber = new BigInteger(aSign, aBytes);
		BigInteger exp = new BigInteger(eSign, eBytes);
		BigInteger modulus = new BigInteger(mSign, mBytes);
		try { 
			aNumber.modPow(exp, modulus);
			fail("ArithmeticException has not been caught");
		} catch (ArithmeticException e) {
			assertEquals("Improper exception message", "BigInteger: modulus not positive", e.getMessage());
		} 
	} 
 
	/** 
	 * modPow: positive exponent 
	 */ 
	public void testModPowPosExp() { 
		byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75, 48, -7};