Package java.math

Examples of java.math.BigInteger.longValue()


      bmax[i] = bx[p];
      bmin[i] = bn[p];
    }
    BigInteger bigintMax = new BigInteger(1,bmax);
    BigInteger bigintMin = new BigInteger(1,bmin);
    return bigintMax.longValue() - bigintMin.longValue() + 1;
  }
  /**
   * IPアドレス文字列、"xxx.xxx.xxx.xxx" → byte[].
   * @param s IPアドレス文字列
   * @return byte[]
View Full Code Here


                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 scale = x.scale();
            BigInteger b = x.unscaledValue();
            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;
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

        BigInteger bo = BigInteger.valueOf(other.value);
        BigInteger br = bv.multiply(bo);
        if (br.compareTo(MIN) < 0 || br.compareTo(MAX) > 0) {
            throw getOverflow();
        }
        return ValueLong.get(br.longValue());
    }

    public Value divide(Value v) {
        ValueLong other = (ValueLong) v;
        if (other.value == 0) {
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

    BigInteger bo = BigInteger.valueOf(other.value);
    BigInteger br = bv.multiply(bo);
    if (br.compareTo(MIN) < 0 || br.compareTo(MAX) > 0) {
      throw getOverflow();
    }
    return ValueLong.get(br.longValue());
  }

  public Value divide(Value v) {
    ValueLong other = (ValueLong) v;
    if (other.value == 0) {
View Full Code Here

                "Number out of range for 64-bit unsigned integer: " + text);
            }
          }
        }

        result = bigValue.longValue();
      }

      return result;
    }
   
View Full Code Here

                + text);
          }
        }
      }

      result = bigValue.longValue();
    }

    return result;
  }
}
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.