Package java.math

Examples of java.math.BigInteger.divide()


        }
        if (divisor == 1) {
            return this;
        }
        BigInteger nanos = toNanos();
        nanos = nanos.divide(BigInteger.valueOf(divisor));
        BigInteger[] divRem = nanos.divideAndRemainder(Instant.BILLION);
        return seconds(divRem[0].longValue(), divRem[1].intValue());
     }

    //-----------------------------------------------------------------------
View Full Code Here


    long temp = rand.getHigh8();
    if (temp < 0) {
      // use biginteger to avoid the negative sign problem
      BigInteger bigTemp = makeBigInteger(temp);
      recBuf[0] = (byte) (' ' + (bigTemp.mod(NINETY_FIVE).longValue()));
      temp = bigTemp.divide(NINETY_FIVE).longValue();
    } else {
      recBuf[0] = (byte) (' ' + (temp % 95));
      temp /= 95;     
    }
    for(int i=1; i < 8; ++i) {
View Full Code Here

    }
    temp = rand.getLow8();
    if (temp < 0) {
      BigInteger bigTemp = makeBigInteger(temp);
      recBuf[8] = (byte) (' ' + (bigTemp.mod(NINETY_FIVE).longValue()));
      temp = bigTemp.divide(NINETY_FIVE).longValue();     
    } else {
      recBuf[8] = (byte) (' ' + (temp % 95));
      temp /= 95;
    }
    recBuf[9] = (byte)(' ' + (temp % 95));
View Full Code Here

    BigInteger n = new BigInteger(number);
    while (!n.equals(BigInteger.ZERO)) {
      n = n.add(BigInteger.valueOf(-1));
      int r = n.mod(BigInteger.valueOf(26)).intValue();
      word.add((char)('a' + r));
      n = n.divide(BigInteger.valueOf(26));
    }
    Collections.reverse(word);
   
    StringBuilder builder = new StringBuilder();
    for (Character c : word) {
View Full Code Here

        BigInteger expectation = BigInteger.ZERO;
        for (int i = 0; i < values.length; i++) {
            expectation = expectation.add(values[i]);
        }
        expectation = expectation.divide(BigInteger.valueOf(values.length));

        Aggregation<String, BigInteger, BigInteger> aggregation = Aggregations.bigIntegerAvg();
        BigInteger result = testAvg(values, aggregation);
        assertEquals(expectation, result);
    }
View Full Code Here

        BigInteger expectation = BigInteger.ZERO;
        for (int i = 0; i < values.length; i++) {
            expectation = expectation.add(values[i].value);
        }
        expectation = expectation.divide(BigInteger.valueOf(values.length));

        Aggregation<String, BigInteger, BigInteger> aggregation = Aggregations.bigIntegerAvg();
        BigInteger result = testAvgWithExtractor(values, aggregation);
        assertEquals(expectation, result);
    }
View Full Code Here

        BigInteger expectation = BigInteger.ZERO;
        for (int i = 0; i < values.length; i++) {
            expectation = expectation.add(values[i]);
        }
        expectation = expectation.divide(BigInteger.valueOf(values.length));

        Aggregation<String, BigInteger, BigInteger> aggregation = Aggregations.bigIntegerAvg();
        BigInteger result = testAvg(values, aggregation);
        assertEquals(expectation, result);
    }
View Full Code Here

        BigInteger expectation = BigInteger.ZERO;
        for (int i = 0; i < values.length; i++) {
            expectation = expectation.add(values[i].value);
        }
        expectation = expectation.divide(BigInteger.valueOf(values.length));

        Aggregation<String, BigInteger, BigInteger> aggregation = Aggregations.bigIntegerAvg();
        BigInteger result = testAvgWithExtractor(values, aggregation);
        assertEquals(expectation, result);
    }
View Full Code Here

                for (Map.Entry<Key, AvgTuple<Long, BigInteger>> entry : values) {
                    AvgTuple<Long, BigInteger> tuple = entry.getValue();
                    count += tuple.getFirst();
                    amount = amount.add(tuple.getSecond());
                }
                return amount.divide(BigInteger.valueOf(count));
            }
        };
    }

    @Override
View Full Code Here

        BigInteger expectation = BigInteger.ZERO;
        for (int i = 0; i < values.length; i++) {
            expectation = expectation.add(values[i]);
        }
        expectation = expectation.divide(BigInteger.valueOf(values.length));

        Aggregation<String, BigInteger, BigInteger> aggregation = Aggregations.bigIntegerAvg();
        BigInteger result = testAvg(values, aggregation);
        assertEquals(expectation, 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.