Package java.math

Examples of java.math.BigInteger.longValue()


    {
        BigInteger b = getBigIntegerValue();
        if (b == null) return 0L;
        if (b.compareTo(_max) >= 0) throw new XmlValueOutOfRangeException();
        if (b.compareTo(_min) <= 0) throw new XmlValueOutOfRangeException();
        return b.longValue();
    }

    private static final XmlOptions _toStringOptions =
        buildInnerPrettyOptions();
View Full Code Here


        if (total.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0)
        {
            throw new IllegalArgumentException("Total number of combinations must not be more than 2^63.");
        }

        totalCombinations = total.longValue();
        reset();
    }


    /**
 
View Full Code Here

            long a = in.nextInt();
            long b = in.nextInt();
            total = total.add(BigInteger.valueOf(a * b * 10000));
        }
        total = total.remainder(length);
        long result = total.longValue();
        result = Math.min(result, length.longValue() - result);
        out.printf("%d.%04d\n", result / 10000, result % 10000);
        out.flush();
    }
}
View Full Code Here

                    if ( gt > 0 || lt < 0 )
                    {
                        throw new PSQLException(GT.tr("Bad value for type {0} : {1}", new Object[]{"long",s}),
                                                PSQLState.NUMERIC_VALUE_OUT_OF_RANGE);
                    }
                    return i.longValue();
                }
                catch ( NumberFormatException ne )
                {
                    throw new PSQLException(GT.tr("Bad value for type {0} : {1}", new Object[]{"long",s}),
                                            PSQLState.NUMERIC_VALUE_OUT_OF_RANGE);
View Full Code Here

    if (value instanceof BigInteger) {
      BigInteger big = (BigInteger) value;
      if (big.compareTo(INTEGER_MAX) < 0) {
        return big.intValue();
      } else if (big.compareTo(LONG_MAX) < 0) {
        return big.longValue();
      }
    }
    // No need to convert to float or double since those lose precision
    return value;
  }
View Full Code Here

                        subtract(BigInteger.valueOf(rangeMin));
                }

                if (availBig.compareTo(BigInteger.valueOf(adjust)) < 0) {
                    /* If availBig < adjust then availBig fits in an int. */
                    int availInt = (int) availBig.longValue();
                    if (availInt < delta) {
                        if (wrapAllowed) {
                            /* Wrap to the opposite range end point. */
                            storedValue = increment ? rangeMin : rangeMax;
                            wrapped = true;
View Full Code Here

      args = args.cdr();
    };

    if ((sum.compareTo(MAXINT) <= 0)    // If LispInteger size...
            && (sum.compareTo(MININT) >= 0))
      return (f_lisp.makeInteger(sum.longValue()));
    else
      return (f_lisp.makeBignum(sum));
  }

View Full Code Here

      arglist = arglist.cdr();
    };

    if ((product.compareTo(MAXINT) <= 0)    // If LispInteger size...
            && (product.compareTo(MININT) >= 0))
      return (f_lisp.makeInteger(product.longValue()));
    else
      return (f_lisp.makeBignum(product));
  }

View Full Code Here

    };


    if ((sum.compareTo(MAXINT) <= 0)    // If LispInteger size...
            && (sum.compareTo(MININT) >= 0))
      return (f_lisp.makeInteger(sum.longValue()));
    else
      return (f_lisp.makeBignum(sum));
  }

View Full Code Here

        bmax[i] = bx[k];
        bmin[i] = br[k];
      }
      BigInteger bigintMax = new BigInteger(1,bmax);
      BigInteger bigintMin = new BigInteger(1,bmin);
      return bigintMax.longValue() - bigintMin.longValue() + 1;
    }
    byte[] bn = new BigInteger(1,bw).toByteArray();
    byte[] bmax = new byte[4];
    byte[] bmin = new byte[4];
    int p = bx.length > 4 ? 1 : 0;
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.