Package java.math

Examples of java.math.BigInteger.longValue()


        BigInteger ulonglongValue = new BigInteger("12345678900");
        writer.writeULongLong(ulonglongValue);
       
        InputStream iStream = oStream.create_input_stream();
        long ul = iStream.read_ulonglong();
        assertTrue(ul == ulonglongValue.longValue());
    }
   
    public void testWriteFloat() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
View Full Code Here


       
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        BigInteger ulongValue = reader.readULong();
        assertTrue(ulongValue.longValue() == 100000);
    }
   
    public void testReadLongLong() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
View Full Code Here

       
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        BigInteger ulonglongValue = reader.readULongLong();
        assertTrue(ulonglongValue.longValue() == -1000000000);
    }
   
    public void testReadFloat() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
View Full Code Here

        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_MINUTE));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_HOUR));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_DAY));
        expected = expected.divide(BigInteger.valueOf(DateTimeConstants.MILLIS_PER_WEEK));
        assertTrue(expected.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) < 0);
        assertEquals(expected.longValue(), test.toStandardWeeks().getWeeks());
       
        test = new Period(0, 0, Integer.MAX_VALUE, 7, 0, 0, 0, 0);
        try {
            test.toStandardWeeks();
            fail();
View Full Code Here

        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_SECOND));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_MINUTE));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_HOUR));
        expected = expected.divide(BigInteger.valueOf(DateTimeConstants.MILLIS_PER_DAY));
        assertTrue(expected.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) < 0);
        assertEquals(expected.longValue(), test.toStandardDays().getDays());
       
        test = new Period(0, 0, 0, Integer.MAX_VALUE, 24, 0, 0, 0);
        try {
            test.toStandardDays();
            fail();
View Full Code Here

        BigInteger expected = BigInteger.valueOf(intMax);
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_SECOND));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_MINUTE));
        expected = expected.divide(BigInteger.valueOf(DateTimeConstants.MILLIS_PER_HOUR));
        assertTrue(expected.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) < 0);
        assertEquals(expected.longValue(), test.toStandardHours().getHours());
       
        test = new Period(0, 0, 0, 0, Integer.MAX_VALUE, 60, 0, 0);
        try {
            test.toStandardHours();
            fail();
View Full Code Here

        long intMax = Integer.MAX_VALUE;
        BigInteger expected = BigInteger.valueOf(intMax);
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_SECOND));
        expected = expected.divide(BigInteger.valueOf(DateTimeConstants.MILLIS_PER_MINUTE));
        assertTrue(expected.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) < 0);
        assertEquals(expected.longValue(), test.toStandardMinutes().getMinutes());
       
        test = new Period(0, 0, 0, 0, 0, Integer.MAX_VALUE, 60, 0);
        try {
            test.toStandardMinutes();
            fail();
View Full Code Here

     */

    public static DateTimeValue fromJulianInstant(BigDecimal instant) {
        BigInteger julianSecond = instant.toBigInteger();
        BigDecimal microseconds = instant.subtract(new BigDecimal(julianSecond)).multiply(DecimalValue.BIG_DECIMAL_ONE_MILLION);
        long js = julianSecond.longValue();
        long jd = js / (24L * 60L * 60L);
        DateValue date = DateValue.dateFromJulianDayNumber((int)jd);
        js = js % (24L * 60L * 60L);
        byte hour = (byte)(js / (60L * 60L));
        js = js % (60L * 60L);
 
View Full Code Here

    for (int n = 0; n <= 50; n++) {
      for(int k = 0; k <= n; k++) {
        BigInteger x = Library.binomial(n, k);
        if (x.bitLength() >= 64)
          throw new AssertionError("Number too large to handle");
        numbers.add(x.longValue());
        max = Math.max(x.longValue(), max);
      }
    }
   
    // Prepare list of squared primes
View Full Code Here

      for(int k = 0; k <= n; k++) {
        BigInteger x = Library.binomial(n, k);
        if (x.bitLength() >= 64)
          throw new AssertionError("Number too large to handle");
        numbers.add(x.longValue());
        max = Math.max(x.longValue(), max);
      }
    }
   
    // Prepare list of squared primes
    int[] primes = Library.listPrimes((int)Library.sqrt(max));
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.