Code example for BigInteger

Methods: subtract

0
    public void test_ConstructorI$B() { 
        byte[] myByteArray;
        myByteArray = new byte[] { (byte) 0xFF, (byte) 0xFE };
        bi = new BigInteger(1, myByteArray);
        assertTrue("Incorrect value for pos number", bi.equals(BigInteger.ZERO
                .setBit(16).subtract(two)));
        bi = new BigInteger(-1, myByteArray);
        assertTrue("Incorrect value for neg number", bi.equals(BigInteger.ZERO
                .setBit(16).subtract(two).negate()));
        myByteArray = new byte[] { (byte) 0, (byte) 0 };
        bi = new BigInteger(0, myByteArray);
        assertTrue("Incorrect value for zero", bi.equals(zero));
        myByteArray = new byte[] { (byte) 1 };
        try { 
            new BigInteger(0, myByteArray);
            fail("Failed to throw NumberFormatException");
        } catch (NumberFormatException e) {
            // correct 
        } 
    }