java.math.BigInteger.min()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中java.math.BigInteger.min()方法的一些代码示例,展示了BigInteger.min()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BigInteger.min()方法的具体详情如下:
包路径:java.math.BigInteger
类名称:BigInteger
方法名:min

BigInteger.min介绍

[英]Returns the minimum of this BigInteger and value.
[中]返回此BigInteger和值的最小值。

代码示例

代码示例来源:origin: google/guava

@Override
public long distance(BigInteger start, BigInteger end) {
 return end.subtract(start).max(MIN_LONG).min(MAX_LONG).longValue();
}

代码示例来源:origin: prestodb/presto

@Override
public long distance(BigInteger start, BigInteger end) {
 return end.subtract(start).max(MIN_LONG).min(MAX_LONG).longValue();
}

代码示例来源:origin: google/j2objc

@Override
public long distance(BigInteger start, BigInteger end) {
 return end.subtract(start).max(MIN_LONG).min(MAX_LONG).longValue();
}

代码示例来源:origin: wildfly/wildfly

@Override
public long distance(BigInteger start, BigInteger end) {
 return end.subtract(start).max(MIN_LONG).min(MAX_LONG).longValue();
}

代码示例来源:origin: eclipse/eclipse-collections

@Override
public void value(BigInteger each)
{
  this.count++;
  if (each != null)
  {
    this.sum = this.sum.add(each);
    this.min = this.min == null ? each : this.min.min(each);
    this.max = this.max == null ? each : this.max.max(each);
  }
}

代码示例来源:origin: eclipse/eclipse-collections

@Override
public void value(BigInteger each)
{
  this.count++;
  if (each != null)
  {
    this.sum = this.sum.add(each);
    this.min = this.min == null ? each : this.min.min(each);
    this.max = this.max == null ? each : this.max.max(each);
  }
}

代码示例来源:origin: eclipse/eclipse-collections

public BigIntegerSummaryStatistics merge(BigIntegerSummaryStatistics summaryStatistics)
  {
    this.count += summaryStatistics.count;
    this.sum = this.sum.add(summaryStatistics.sum);
    if (summaryStatistics.min != null)
    {
      this.min = this.min == null ? summaryStatistics.min : this.min.min(summaryStatistics.min);
    }
    if (summaryStatistics.max != null)
    {
      this.max = this.max == null ? summaryStatistics.max : this.max.max(summaryStatistics.max);
    }
    return this;
  }
}

代码示例来源:origin: eclipse/eclipse-collections

public BigIntegerSummaryStatistics merge(BigIntegerSummaryStatistics summaryStatistics)
  {
    this.count += summaryStatistics.count;
    this.sum = this.sum.add(summaryStatistics.sum);
    if (summaryStatistics.min != null)
    {
      this.min = this.min == null ? summaryStatistics.min : this.min.min(summaryStatistics.min);
    }
    if (summaryStatistics.max != null)
    {
      this.max = this.max == null ? summaryStatistics.max : this.max.max(summaryStatistics.max);
    }
    return this;
  }
}

代码示例来源:origin: jphp-group/jphp

private static BigDecimal bcpowImpl(BigDecimal base, BigInteger exp, int scale) {
  if (exp.compareTo(BigInteger.ZERO) == 0)
    return BigDecimal.ONE;
  boolean isNeg;
  if (exp.compareTo(BigInteger.ZERO) < 0) {
    isNeg = true;
    exp = exp.negate();
  }
  else
    isNeg = false;
  BigDecimal result = BigDecimal.ZERO;
  while (exp.compareTo(BigInteger.ZERO) > 0) {
    BigInteger expSub = exp.min(INTEGER_MAX);
    exp = exp.subtract(expSub);
    result = result.add(base.pow(expSub.intValue()));
  }
  if (isNeg)
    result = BigDecimal.ONE.divide(result, scale + 2, RoundingMode.DOWN);
  result = result.setScale(scale, RoundingMode.DOWN);
  if (result.compareTo(BigDecimal.ZERO) == 0)
    return BigDecimal.ZERO;
  result = result.stripTrailingZeros();
  return result;
}

代码示例来源:origin: prestodb/presto

@Override
public BigInteger visitBinaryFunction(BinaryFunctionContext ctx)
{
  BigInteger left = visit(ctx.left);
  BigInteger right = visit(ctx.right);
  switch (ctx.binaryFunctionName().name.getType()) {
    case MIN:
      return left.min(right);
    case MAX:
      return left.max(right);
    default:
      throw new IllegalArgumentException("Unsupported binary function " + ctx.binaryFunctionName().getText());
  }
}

代码示例来源:origin: hcoles/pitest

@Override
 BigInteger apply(BigInteger left, BigInteger right) {
  return left.min(right);
 }
}

代码示例来源:origin: org.apache.xmlbeans/xmlbeans

max = (max == null ? peg : max.min(peg));

代码示例来源:origin: vsch/flexmark-java

BigInteger combine(BigInteger orig, BigInteger copy, BigInteger other) {
    if (this == ADD) {
      return copy == null && orig == null ? null : safeBigInt(copy).add(safeBigInt(orig));
    } else if (this == MAX) {
      return copy == null && orig == null ? null : safeBigInt(copy).max(safeBigInt(orig));
    } else if (this == MIN) {
      return copy == null && orig == null ? null : safeBigInt(copy).max(safeBigInt(orig));
    } else if (this == ADD_OTHER) {
      return copy == null && orig == null && other == null ? null : safeBigInt(copy).add(safeBigInt(orig).add(safeBigInt(other)));
    } else if (this == MAX_OTHER) {
      return copy == null && orig == null && other == null ? null : safeBigInt(copy).max(safeBigInt(orig).max(safeBigInt(other)));
    } else if (this == MIN_OTHER) {
      return copy == null && orig == null && other == null ? null : safeBigInt(copy).min(safeBigInt(orig).min(safeBigInt(other)));
    } else if (this == RANGE) {
      return copy == null && orig == null && other == null ? null : safeBigInt(copy).max(safeBigInt(orig).min(safeBigInt(other)));
    } else {
      return copy;
    }
  }
}

代码示例来源:origin: apache/servicemix-bundles

private BigInteger min(BigInteger a, BigInteger b) {
  if(a==null) return b;
  if(b==null) return a;
  return a.min(b);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public void reduce(BigInteger value) {
  min = min == null ? value : value.min(min);
}

代码示例来源:origin: jitlogic/zorka

public SNMPGauge32(long newValue)
{
  tag = SNMPBERCodec.SNMPGAUGE32;
  
  value = new BigInteger(new Long(newValue).toString());
  
  // peg if value > maxValue
  value = value.min(maxValue);
}

代码示例来源:origin: org.apache.xmlbeans/xmlbeans

minOccurs = minOccurs.min(from.getMinOccurs());
if (maxOccurs != null)
  maxOccurs = (from.getMaxOccurs() == null ? null :

代码示例来源:origin: vsch/flexmark-java

final BigInteger[] divideAndRemainder = indentDiff.divideAndRemainder(BigInteger.valueOf(20));
BigInteger space = safeBigInt(leftBorder.getSpace()).add(divideAndRemainder[0]).min(BigInteger.valueOf(31));
leftBorder.setSpace(space);

代码示例来源:origin: org.eclipse.collections/eclipse-collections

@Override
public void value(BigInteger each)
{
  this.count++;
  if (each != null)
  {
    this.sum = this.sum.add(each);
    this.min = this.min == null ? each : this.min.min(each);
    this.max = this.max == null ? each : this.max.max(each);
  }
}

代码示例来源:origin: KostyaSha/yet-another-docker-plugin

@Override
public long distance(BigInteger start, BigInteger end) {
 return end
   .subtract(start)
   .max(MIN_LONG)
   .min(MAX_LONG)
   .longValue();
}

相关文章