Lines Matching defs:bitLength

137      * One plus the bitLength of this BigInteger. Zeros means unitialized.
141 * @see #bitLength()
146 private int bitLength;
486 * @param numBits maximum bitLength of the new BigInteger.
490 * @see #bitLength()
513 * prime, with the specified bitLength.
519 * @param bitLength bitLength of the returned BigInteger.
527 * @throws ArithmeticException {@code bitLength < 2}.
528 * @see #bitLength()
530 public BigInteger(int bitLength, int certainty, Random rnd) {
533 if (bitLength < 2)
534 throw new ArithmeticException("bitLength < 2");
536 prime = (bitLength < 95 ? smallPrime(bitLength, certainty, rnd)
537 : largePrime(bitLength, certainty, rnd));
551 * specified bitLength. The probability that a BigInteger returned
554 * @param bitLength bitLength of the returned BigInteger.
557 * @return a BigInteger of {@code bitLength} bits that is probably prime
558 * @throws ArithmeticException {@code bitLength < 2}.
559 * @see #bitLength()
562 public static BigInteger probablePrime(int bitLength, Random rnd) {
563 if (bitLength < 2)
564 throw new ArithmeticException("bitLength < 2");
567 return (bitLength < SMALL_PRIME_THRESHOLD ?
568 smallPrime(bitLength, DEFAULT_PRIME_CERTAINTY, rnd) :
569 largePrime(bitLength, DEFAULT_PRIME_CERTAINTY, rnd));
573 * Find a random number of the specified bitLength that is probably prime.
577 * This method assumes bitLength > 1.
579 private static BigInteger smallPrime(int bitLength, int certainty, Random rnd) {
580 int magLen = (bitLength + 31) >>> 5;
582 int highBit = 1 << ((bitLength+31) & 0x1f); // High bit of high int
590 if (bitLength > 2)
596 if (bitLength > 6) {
604 // All candidates of bitLength 2 and 3 are prime by this point
605 if (bitLength < 4)
618 * Find a random number of the specified bitLength that is probably prime.
623 private static BigInteger largePrime(int bitLength, int certainty, Random rnd) {
625 p = new BigInteger(bitLength, rnd).setBit(bitLength-1);
629 int searchLen = (bitLength / 20) * 64;
633 while ((candidate == null) || (candidate.bitLength() != bitLength)) {
635 if (p.bitLength() != bitLength)
636 p = new BigInteger(bitLength, rnd).setBit(bitLength-1);
667 if (result.bitLength() < SMALL_PRIME_THRESHOLD) {
675 if (result.bitLength() > 6) {
685 // All candidates of bitLength 2 and 3 are prime by this point
686 if (result.bitLength() < 4)
702 int searchLen = (result.bitLength() / 20) * 64;
718 * This method assumes bitLength > 2.
735 int sizeInBits = this.bitLength();
844 for (int i=k.bitLength()-2; i>=0; i--) {
904 b = new BigInteger(this.bitLength(), rnd);
1506 private static int bitLength(int[] val, int len) {
1715 int ebits = bitLength(exp, exp.length);
1978 int limit = exponent.bitLength();
1999 if (bitLength() <= p)
2395 public int bitLength() {
2396 @SuppressWarnings("deprecation") int n = bitLength - 1;
2397 if (n == -1) { // bitLength not initialized yet
2416 bitLength = n + 1;
2695 * least one sign bit, which is {@code (ceil((this.bitLength() +
2704 int byteLen = bitLength()/8 + 1;
2994 return (bitLength() >>> 5) + 1;
3058 * @serialField bitLength int
3068 new ObjectStreamField("bitLength", Integer.TYPE),
3080 * bitLength and lowestSetBit, to 0 rather than some other marker value.
3155 fields.put("bitLength", -1);