Example usage for java.math BigInteger ZERO

List of usage examples for java.math BigInteger ZERO

Introduction

In this page you can find the example usage for java.math BigInteger ZERO.

Prototype

BigInteger ZERO

To view the source code for java.math BigInteger ZERO.

Click Source Link

Document

The BigInteger constant zero.

Usage

From source file:com.google.uzaygezen.core.ranges.BigIntegerRange.java

BigInteger overlap(BigIntegerRange other) {
    if (start.compareTo(other.getEnd()) >= 0 || end.compareTo(other.getStart()) <= 0) {
        return BigInteger.ZERO;
    } else {//from  w  w w  .  j  a v a  2  s. c o m
        if (start.compareTo(other.getStart()) < 0 || end.compareTo(other.getEnd()) > 0) {
            BigInteger x = getEnd().min(other.getEnd());
            BigInteger y = getStart().max(other.getStart());
            return x.subtract(y);
        } else {
            return end.subtract(start);
        }
    }
}

From source file:PalidromeArray.java

public PalidromeArray(BigInteger[] array) {
    this.totalLength = BigInteger.valueOf(array.length);
    this.halfLength = totalLength.divide(TWO);
    if (MathUtil.isOdd(totalLength)) {
        isEven = false;/*  w w  w .j  a v  a  2s .c  om*/
        halfLength = halfLength.add(BigInteger.ONE);
    }
    this.array = new ConcurrentHashMap<BigInteger, BigInteger>();

    BigInteger index = BigInteger.ZERO;
    for (BigInteger bi : array) {
        this.array.put(index, bi);
        index = index.add(BigInteger.ONE);
    }
}

From source file:edu.hku.sdb.udf.util.UDFHandler.java

/**
 * Return true is value is zero.//ww  w  .j ava  2 s  . c  om
 *
 * @param value
 * @return
 */
public static boolean equal(BigInteger value) {
    return value.equals(BigInteger.ZERO);
}

From source file:io.instacount.appengine.counter.Counter.java

/**
 * Required-args Constructor. Sets the {@code count} to zero.
 *
 * @param name//from w ww.  j  av a2  s.c  om
 * @param counterStatus
 * @param numShards
 * @param counterStatus
 */
public Counter(final String name, final String description, final int numShards,
        final CounterData.CounterStatus counterStatus, final CounterIndexes indexes) {
    this(name, description, numShards, counterStatus, BigInteger.ZERO, indexes, DateTime.now(DateTimeZone.UTC));
}

From source file:com.artivisi.iso8583.Message.java

public String getSecondaryBitmapStream() {
    if (secondaryBitmap == null || BigInteger.ZERO.equals(secondaryBitmap)) {
        return "";
    }/*from w  w  w  .  j a va  2s  .  co  m*/
    return StringUtils.leftPad(secondaryBitmap.toString(16).toUpperCase(), 16, "0");
}

From source file:org.kuali.kfs.module.endow.businessobject.TransactionArchive.java

public TransactionArchive() {
    archiveSecurities = new ArrayList<TransactionArchiveSecurity>();
    principalCashAmount = new BigDecimal(BigInteger.ZERO, 2);
    incomeCashAmount = new BigDecimal(BigInteger.ZERO, 2);
    corpusAmount = new BigDecimal(BigInteger.ZERO, 2);
}

From source file:co.rsk.remasc.RemascStorageProviderTest.java

@Test
public void getDefautBurnedBalance() {
    String accountAddress = randomAddress();
    Repository repository = new RepositoryImpl();

    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);

    Assert.assertEquals(BigInteger.ZERO, provider.getBurnedBalance());
}

From source file:io.syndesis.model.integration.IntegrationRevision.java

public static IntegrationRevision createNewRevision(Integration integration) {
    int version = integration.getRevisions().stream().map(i -> i.getVersion().orElse(0)).reduce(Integer::max)
            .orElse(0);//from w w  w . ja v a  2  s  .co  m

    BigInteger totalTimesUsed = integration.getTimesUsed().orElse(BigInteger.ZERO);
    BigInteger parentUses = integration.getRevisions().stream()
            .map(i -> i.getTimesUsed().orElse(BigInteger.ZERO)).reduce((n1, n2) -> n1.add(n2))
            .orElse(BigInteger.ZERO);

    return new IntegrationRevision.Builder().version(version + 1).parentVersion(version)
            .spec(new IntegrationRevisionSpec.Builder().configuration(integration.getConfiguration())
                    .connections(integration.getConnections()).steps(integration.getSteps()).build())
            .currentState(IntegrationRevisionState
                    .from(integration.getCurrentStatus().orElse(Integration.Status.Draft)))
            .currentMessage(integration.getStatusMessage())
            .targetState(IntegrationRevisionState
                    .from(integration.getDesiredStatus().orElse(Integration.Status.Draft)))
            .timesUsed(Optional.of(totalTimesUsed.subtract(parentUses)))
            //We retain the information found on the integration and we override when needed, why?
            //Because this is not called just when we want to create a new revision,
            //but can be used when editing the current one.
            .createdDate(integration.getCreatedDate()).lastUpdated(integration.getLastUpdated()).build();
}

From source file:org.apache.streams.data.moreover.MoreoverClient.java

public MoreoverResult getArticlesAfter(String sequenceId, int limit) throws IOException {
    String urlString = getUrlString(this.apiKey, limit, sequenceId);
    logger.debug("Making call to {}", urlString);
    long start = System.nanoTime();
    MoreoverResult result = new MoreoverResult(id, getArticles(new URL(urlString)), start, System.nanoTime());
    result.process();//  w  w  w  .j  a  v  a  2  s .  co  m
    if (!result.getMaxSequencedId().equals(BigInteger.ZERO) && (this.lastSequenceId == null
            || !this.lastSequenceId.equals(result.getMaxSequencedId().toString()))) {
        this.lastSequenceId = result.getMaxSequencedId().toString();
        logger.debug("Maximum sequence from last call {}", this.lastSequenceId);
    } else {
        logger.debug("No maximum sequence returned in last call. Previous sequence = {}", this.lastSequenceId);
    }
    return result;
}

From source file:Ternary.java

public Ternary(BigInteger toConvert) {
    this();/* ww  w .j ava  2s . c o m*/
    int position = 0;
    BigInteger remaining = toConvert;
    BigInteger rounded, left;
    while (!remaining.equals(BigInteger.ZERO)) {
        rounded = ((new BigDecimal(remaining)).divide(bdThree, 0, BigDecimal.ROUND_HALF_UP)).toBigInteger();
        left = remaining.subtract(rounded.multiply(biThree));
        if (left.equals(BigInteger.ONE))
            setTrit(position++, Trit.POSITIVE);
        else if (left.equals(BigInteger.ZERO))
            setTrit(position++, Trit.NEUTRAL);
        else
            setTrit(position++, Trit.NEGATIVE);
        remaining = rounded;
    }
}