Code example for BigInteger

Methods: mod

0
    public void testCase22() { 
        byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
        byte bBytes[] = {1, 30, 40, 56, -1, 45};
        int aSign = 1;
        int bSign = -1;        
        BigInteger aNumber = new BigInteger(aSign, aBytes);
        BigInteger bNumber = new BigInteger(bSign, bBytes);
        try { 
            aNumber.mod(bNumber);
            fail("ArithmeticException has not been caught");
        } catch (ArithmeticException e) {
            assertEquals("Improper exception message", "BigInteger: modulus not positive", e.getMessage());
        } 
    } 
 
    /** 
     * mod when a divisor is positive 
     */ 
    public void testCase23() { 
        byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75};
        byte bBytes[] = {27, -15, 65, 39, 100};