Package java.math

Examples of java.math.BigInteger.clearBit()


        byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
        int aSign = 1;
        int number = -7;
        BigInteger aNumber = new BigInteger(aSign, aBytes);
        try {
            aNumber.clearBit(number);
            fail("ArithmeticException has not been caught");
        } catch (ArithmeticException e) {
            assertEquals("Improper exception message", "Negative bit address", e.getMessage());
        }
    }
View Full Code Here


                if (bitIndex < 0) {
                    return false;
                }

                return bintValue.clearBit(bitIndex).equals(BigInteger.ZERO);
            }
        };
    }

    /**
 
View Full Code Here

            if (az.testBit(this.m))
            {
                // If the coefficient of z^m in a(z) equals 1, reduction
                // modulo f(z) is performed: Add f(z) to to a(z):
                // Step 1: Unset mth coeffient of a(z)
                az = az.clearBit(this.m);

                // Step 2: Add r(z) to a(z), where r(z) is defined as
                // f(z) = z^m + r(z), and k1, k2, k3 are the positions of
                // the non-zero coefficients in r(z)
                az = az.flipBit(0);
View Full Code Here

        byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
        int aSign = 1;
        int number = -7;
        BigInteger aNumber = new BigInteger(aSign, aBytes);
        try {
            aNumber.clearBit(number);
            fail("ArithmeticException has not been caught");
        } catch (ArithmeticException e) {
            assertEquals("Improper exception message", "Negative bit address", e.getMessage());
        }
    }
View Full Code Here

                if (bitIndex < 0) {
                    return false;
                }

                return bintValue.clearBit(bitIndex).equals(BigInteger.ZERO);
            }
        };
    }

    /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.