Java Utililty Methods BigInteger Max

List of utility methods to do BigInteger Max

  1. HOME
  2. Java
  3. B
  4. BigInteger Max

Description

The list of methods to do BigInteger Max are organized into topic(s).

Method

BigInteger max(BigInteger a, BigInteger b)
Since Math.max() doesn't handle BigInteger
if (a == null)
 return b;
if (b == null)
 return a;
int c = a.compareTo(b);
return c < 0 ? b : a;
BigInteger max(BigInteger first, BigInteger second)
max
return first.compareTo(second) < 0 ? second : first;
BigInteger maxValue(final BigInteger... values)
Computes the maximum value of a given BigInteger array.
if (values == null || values.length == 0) {
 throw new IllegalArgumentException();
BigInteger maxValue = null;
for (final BigInteger value : values) {
 if (value == null) {
 throw new IllegalArgumentException();
 if (maxValue == null) {
 maxValue = value;
 } else {
 maxValue = maxValue.max(value);
return maxValue;

AltStyle によって変換されたページ (->オリジナル) /