Package java.math

Examples of java.math.BigInteger.longValue()


      throw parsingError(string, node);
    }
    String withoutZeroX = removeZeroX(string);
    try {
      BigInteger value = new BigInteger(withoutZeroX, 16);
      long longValue = value.longValue();
      return longValue != -1 ? longValue : 1L;
    } catch (NumberFormatException e) {
      throw parsingError(string, node, e);
    }
  }
View Full Code Here


  private Long parseUsingBigInteger(String string, INode node) {
    // error could be overflow, parse again with BigInteger.
    try {
      BigInteger value = new BigInteger(string, 10);
      long longValue = value.longValue();
      return longValue != -1 ? longValue : 1L;
    } catch (NumberFormatException e) {
      throw parsingError(string, node, e);
    }
  }
View Full Code Here

     * a long value, otherwise precision will be lost in this conversion.
     */
    @Override
    public Long getLong(Object number) {
        BigInteger longField = (BigInteger) number;
        return longField.longValue();
    }

}
View Full Code Here

            sum += longArray[i];
        }

        if (dashPhase != 0) {
            gcd = gcd.gcd(BigInteger.valueOf(longPhase));
            longPhase /= gcd.longValue();
        }

        sum /= gcd.longValue();

        if (sum > 16) {
View Full Code Here

        if (dashPhase != 0) {
            gcd = gcd.gcd(BigInteger.valueOf(longPhase));
            longPhase /= gcd.longValue();
        }

        sum /= gcd.longValue();

        if (sum > 16) {
            return false;
        }
View Full Code Here

            default:
                return false;
        }

        int intPattern = 0;
        stippleFactor = (int) gcd.longValue();

        for (int i=0; i<repeatNum; i++) {
            for (int j = longArray.length-1; j >= 0; j--) {
                long currPatternLen = longArray[j]/stippleFactor;
                intPattern <<= currPatternLen;
View Full Code Here

        if (sum.compareTo(MAX_LONG) > 0) {
          this.dtime = 0L;
          LOG.warn("Sum of stime (" + this.stime + ") and utime (" + this.utime
              + ") is greater than " + Long.MAX_VALUE);
        } else {
          this.dtime = sum.longValue();
        }
        return;
      }
      this.dtime = (this.utime - oldInfo.utime +
          this.stime.subtract(oldInfo.stime).longValue());
View Full Code Here

        BigInteger ulongValue = new BigInteger("1234567");
        writer.writeULong(ulongValue);
       
        InputStream iStream = oStream.create_input_stream();
        long ul = iStream.read_ulong();
        assertTrue(ul == ulongValue.longValue());
    }
   
    public void testWriteLongLong() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
View Full Code Here

        BigInteger longlongValue = new BigInteger("-12345678900");
        writer.writeLongLong(longlongValue);
       
        InputStream iStream = oStream.create_input_stream();
        long ll = iStream.read_longlong();
        assertTrue(ll == longlongValue.longValue());
    }
   
    public void testWriteULongLong() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
View Full Code Here

        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

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.