Package java.math

Examples of java.math.BigInteger.longValue()


                BigInteger b = x.unscaledValue();
                int bits = b.bitLength();
                if (bits <= 63) {
                    if (scale == 0) {
                        writeByte((byte) DECIMAL_SMALL_0);
                        writeVarLong(b.longValue());
                    } else {
                        writeByte((byte) DECIMAL_SMALL);
                        writeVarInt(scale);
                        writeVarLong(b.longValue());
                    }
View Full Code Here


                        writeByte((byte) DECIMAL_SMALL_0);
                        writeVarLong(b.longValue());
                    } else {
                        writeByte((byte) DECIMAL_SMALL);
                        writeVarInt(scale);
                        writeVarLong(b.longValue());
                    }
                } else {
                    writeByte((byte) type);
                    writeVarInt(scale);
                    byte[] bytes = b.toByteArray();
View Full Code Here

            int bits = b.bitLength();
            if (bits <= 63) {
                if (scale == 0) {
                    return 1 + getVarLongLen(b.longValue());
                }
                return 1 + getVarIntLen(scale) + getVarLongLen(b.longValue());
            }
            byte[] bytes = b.toByteArray();
            return 1 + getVarIntLen(scale) + getVarIntLen(bytes.length) + bytes.length;
        }
        case Value.TIME:
View Full Code Here

        String sub = sqlCommand.substring(start, i);
        checkLiterals(false);
        if (!containsE && sub.indexOf('.') < 0) {
            BigInteger bi = new BigInteger(sub);
            if (bi.compareTo(ValueLong.MAX) <= 0) {
                currentValue = ValueLong.get(bi.longValue());
                currentTokenType = VALUE;
                return;
            }
        }
        BigDecimal bd;
View Full Code Here

            return new ClientProperty(name, null, null, "" + dec.doubleValue());
         }
      }
      if (val instanceof BigInteger) {
         BigInteger dec = (BigInteger)val;
         return new ClientProperty(name, null, null, "" + dec.longValue());
      }
      if (val instanceof Date) {
         // Date date = (Date)val;
         Timestamp ts = rs.getTimestamp(pos);
         // DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
View Full Code Here

        for (int i=0; i<tableCount; i++) {
            // TODO: also bounds-check that we don't go past size
            // track duration
            raf.read (buffy, 0, 4);
            longConverter = new BigInteger (buffy);
            long trackDuration = longConverter.longValue();
            // media time
            raf.read (buffy, 0, 4);
            longConverter = new BigInteger (buffy);
            long mediaTime = longConverter.longValue();
            // media rate
View Full Code Here

            longConverter = new BigInteger (buffy);
            long trackDuration = longConverter.longValue();
            // media time
            raf.read (buffy, 0, 4);
            longConverter = new BigInteger (buffy);
            long mediaTime = longConverter.longValue();
            // media rate
            // TODO: wrong, these 4 bytes are a fixed-point
            // float, 16-bytes left of decimal, 16 right
            // I don't get how apple does this, so I'm just reading
            // the integer part
View Full Code Here

            // (instead of signed int)
            int bytesRead = raf.read (atomSizeBuf, 0, atomSizeBuf.length);
            if (bytesRead < atomSizeBuf.length)
                throw new IOException ("couldn't read atom length");
            BigInteger atomSizeBI = new BigInteger (atomSizeBuf);
            long atomSize = atomSizeBI.longValue();

            // this is kind of a hack to handle the udta problem
            // (see below) when the parent didn't have children,
            // meaning we've read 4 bytes of 0 and the atom is
            // already over
View Full Code Here

                                      extendedAtomSizeBuf.length);
                if (bytesRead != extendedAtomSizeBuf.length)
                    throw new IOException ("Couldn't read extended atom size");
                BigInteger extendedSizeBI =
                    new BigInteger (extendedAtomSizeBuf);
                atomSize = extendedSizeBI.longValue();
            }

            // if this atom size is negative, or extends past end
            // of file, it's extremely suspicious (ie, we're not
            // really in a quicktime file)
View Full Code Here

     */
    public static Number power(Long self, Integer exponent) {
        if (exponent >= 0) {
            BigInteger answer = BigInteger.valueOf(self).pow(exponent);
            if (answer.compareTo(BI_LONG_MIN) >= 0 && answer.compareTo(BI_LONG_MAX) <= 0) {
                return answer.longValue();
            } else {
                return answer;
            }
        } else {
            return power(self, (double) exponent);
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.