Package java.math

Examples of java.math.BigInteger.shiftLeft()


                            && ((word1(d) & 1) == 0)
                    )) {
                    if (j1 > 0) {
                        /* Either dig or dig+1 would work here as the least significant decimal digit.
                           Use whichever would produce a decimal value closer to d. */
                        b = b.shiftLeft(1);
                        j1 = b.compareTo(S);
                        if (((j1 > 0) || (j1 == 0 && (((dig & 1) == 1) || biasUp)))
                            && (dig++ == '9')) {
                                buf.append('9');
                                if (roundOff(buf)) {
View Full Code Here


                b = b.multiply(BigInteger.valueOf(10));
            }

        /* Round off last digit */

        b = b.shiftLeft(1);
        j = b.compareTo(S);
        if ((j > 0) || (j == 0 && (((dig & 1) == 1) || biasUp))) {
//        roundoff:
//            while(*--s == '9')
//                if (s == buf) {
View Full Code Here

      for (int j = 0; j < 4; j++) {       
        Piece cell = board.pieceAt(j, i);
        fourth = fourth << 4;
        fourth |= cell.getPieceNumber();
      }
      res= res.shiftLeft(16);
      res = res.add(BigInteger.valueOf(fourth));
    }
   
   
   
View Full Code Here

    part1 =0L;
    for (int i=9; i<16; ++i) {
      part1 |= i;
      part1 = part1 << 4;
    }
    sol = sol.shiftLeft(32);

    BigInteger part2 = BigInteger.valueOf(part1);
    sol = sol.add( part2);
    return sol;
  }
View Full Code Here

                } else if(fnName.equals(QN_DOCUMENT_ID)) {
                    result = new IntegerValue(doc.getDocId(), Type.INT);
                } else if(fnName.equals(QN_ABSOLUTE_RESOURCE_ID)) {
                   
                    BigInteger absoluteId = BigInteger.valueOf(doc.getCollection().getId());
                    absoluteId = absoluteId.shiftLeft(32);
                    absoluteId = absoluteId.or(BigInteger.valueOf(doc.getDocId()));
                    absoluteId = absoluteId.shiftLeft(1);
                    absoluteId = absoluteId.or(BigInteger.valueOf(doc.getResourceType() & 1));
                    result = new IntegerValue(absoluteId, Type.INTEGER);
                   
View Full Code Here

                } else if(fnName.equals(QN_ABSOLUTE_RESOURCE_ID)) {
                   
                    BigInteger absoluteId = BigInteger.valueOf(doc.getCollection().getId());
                    absoluteId = absoluteId.shiftLeft(32);
                    absoluteId = absoluteId.or(BigInteger.valueOf(doc.getDocId()));
                    absoluteId = absoluteId.shiftLeft(1);
                    absoluteId = absoluteId.or(BigInteger.valueOf(doc.getResourceType() & 1));
                    result = new IntegerValue(absoluteId, Type.INTEGER);
                   
                }
            } else {
View Full Code Here

      {
         BigInteger bi = BigInteger.valueOf(0);
         byte[] address = java.net.InetAddress.getLocalHost().getAddress();
         for (int i = 0; i < 4; i++)
         {
            bi = bi.shiftLeft(8);
            bi = bi.add(BigInteger.valueOf(address[i]));
         }
         bi = bi.shiftLeft(32);
         int code = System.identityHashCode(new Object());
         bi = bi.add(BigInteger.valueOf(code));
View Full Code Here

         for (int i = 0; i < 4; i++)
         {
            bi = bi.shiftLeft(8);
            bi = bi.add(BigInteger.valueOf(address[i]));
         }
         bi = bi.shiftLeft(32);
         int code = System.identityHashCode(new Object());
         bi = bi.add(BigInteger.valueOf(code));
         byte[] bytes = bi.toByteArray();
         StringBuffer buffer = new StringBuffer();
         char[] chars = "0123456789ABCDEF".toCharArray();
View Full Code Here

    @JRubyMethod(name="<<")
    public IRubyObject bn_lshift(IRubyObject n) {
        int nbits = RubyNumeric.num2int(n);
        BigInteger val = this.value;
        if (val.signum() >= 0) {
            return newBN(getRuntime(), val.shiftLeft(nbits));
        } else {
            return newBN(getRuntime(), val.abs().shiftLeft(nbits).negate());
        }
    }
View Full Code Here

    if (bitShift < 0) {
      throw new IllegalArgumentException();
    }
   
    BigInteger shiftedBitValue = BigInteger.ONE;
    shiftedBitValue = shiftedBitValue.shiftLeft(bitShift);
   
    if (bitValue != 0) {
      bitsValue = bitsValue.or(shiftedBitValue);
    } else {
      shiftedBitValue = shiftedBitValue.not();
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.