Package java.math

Examples of java.math.BigInteger.shiftLeft()


                return first;
            // BigInteger.shiftLeft() succumbs to a stack overflow if count
            // is Integer.MIN_VALUE, so...
            if (count == Integer.MIN_VALUE)
                return n.signum() >= 0 ? Fixnum.ZERO : Fixnum.MINUS_ONE;
            return number(n.shiftLeft(count));
        }
        if (second instanceof Bignum) {
            BigInteger count = ((Bignum)second).getValue();
            if (count.signum() > 0)
                throw new ConditionThrowable(new LispError("can't represent result of left shift"));
View Full Code Here


        padBytes[i] = b[0];
      }
    }

    rndInt = new BigInteger(1, padBytes);
    rndInt = rndInt.shiftLeft( (inByteLen + 1) * 8);
    result = BigInteger.valueOf(type);
    result = result.shiftLeft( (padLen - 2) * 8);
    result = result.or(rndInt);
    result = result.or(input);

View Full Code Here

        while(!((r0.equals(ECConstants.ZERO)) && (r1.equals(ECConstants.ZERO))))
        {
            // If r0 is odd
            if (r0.testBit(0))
            {
                u[i] = (byte) ECConstants.TWO.subtract((r0.subtract(r1.shiftLeft(1))).mod(ECConstants.FOUR)).intValue();

                // r0 = r0 - u[i]
                if (u[i] == 1)
                {
                    r0 = r0.clearBit(0);
View Full Code Here

                    if (j == n)
                    {
                        Vj = Vj.mod(ONE.shiftLeft(b));
                    }

                    W = W.add(Vj.shiftLeft(exp));
                }

// 11.3 X = W + 2^(L–1). Comment: 0 ≤ W < 2L–1; hence, 2L–1 ≤ X < 2L.
                BigInteger X = W.add(ONE.shiftLeft(L - 1));
View Full Code Here

                    bigValue = null;
                    value = 0;
                }
                else
                {
                    bigValue = bigValue.shiftLeft(7);
                }
            }
        }

        this.identifier = objId.toString();
View Full Code Here

        BigInteger big = BigInteger.ZERO;
        for (int i = 0; i < str.length(); i++)
        {
            int charpos = 16 * (sigchars - (i + 1));
            BigInteger charbig = BigInteger.valueOf(str.charAt(i) & 0xFFFF);
            big = big.or(charbig.shiftLeft(charpos));
        }
        return big;
    }

    /**
 
View Full Code Here

        BigInteger big = BigInteger.ZERO;
        for (int i = 0; i < str.length(); i++)
        {
            int charpos = 16 * (sigchars - (i + 1));
            BigInteger charbig = BigInteger.valueOf(str.charAt(i) & 0xFFFF);
            big = big.or(charbig.shiftLeft(charpos));
        }
        return big;
    }

    /**
 
View Full Code Here

        int result = 0;
        BigInteger p = ONE;
        while (p.compareTo(a) < 0)
        {
            result++;
            p = p.shiftLeft(1);
        }
        return result;
    }

    /**
 
View Full Code Here

        int result = -1;
        BigInteger p = ONE;
        while (p.compareTo(a) <= 0)
        {
            result++;
            p = p.shiftLeft(1);
        }
        return result;
    }

    /**
 
View Full Code Here

                mhi = BigInteger.valueOf(1<<Log2P);
            }

            b = b.shiftLeft(e[0] + s2);
            BigInteger s = BigInteger.valueOf(1);
            s = s.shiftLeft(s2);
            /* At this point we have the following:
             *   s = 2^s2;
             *   1 > df = b/2^s2 > 0;
             *   (d - prevDouble(d))/2 = mlo/2^s2;
             *   (nextDouble(d) - d)/2 = mhi/2^s2. */
 
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.