Binding for {@link java.lang.Math#max(int, int)}

@param   a   an argument.
@param   b   another argument.
@return  the larger of {@code a} and {@code b}.
486461
public static IntegerBinding max(final ObservableIntegerValue a, final ObservableIntegerValue b) {
        return createIntegerBinding(() -> Math.max(a.get(), b.get()), a, b);
    }
1012232
public static double max(final double a, final double b) {
        if (a > b) {
            return a;
        }
        if (a < b) {
            return b;
        }
        /* if either arg is NaN, return NaN */
        if (a != b) {
            return Double.NaN;
        }
        /* min(+0.0,-0.0) == -0.0 */
        /* 0x8000000000000000L == Double.doubleToRawLongBits(-0.0d) */
        long bits = Double.doubleToRawLongBits(a);
        if (bits == 0x8000000000000000L) {
            return b;
        }
        return a;
    }
647487
public static int max(IntTuple t)
    {
        return IntTupleFunctions.reduce(
            t, Integer.MIN_VALUE, Math::max);
    }
1142255
public static int safeMultiply(int a, int b) {
        long total = (long) a * (long) b;
        if (total < Integer.MIN_VALUE || total > Integer.MAX_VALUE) {
            throw new ArithmeticException("Multiplication overflows an int: " + a + " * " + b);
        }
        return (int) total;
    }
946292
public static double elementMaxAbs( DMatrix3x3 a ) {
        double max = Math.abs(a.a11);
        double tmp = Math.abs(a.a12); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a13); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a21); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a22); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a23); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a31); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a32); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a33); if( tmp > max ) max = tmp;

        return max;
    }
245323
public static int max(int[][] matrix) {
    int max = Integer.MIN_VALUE;
    for (int[] row : matrix) {
      for (int elem : row) {
        max = Math.max(max, elem);
      }
    }
    return max;
  }
663776
public static double elementMax( DMatrix2x2 a ) {
        double max = a.a11;
        if( a.a12 > max ) max = a.a12;
        if( a.a21 > max ) max = a.a21;
        if( a.a22 > max ) max = a.a22;

        return max;
    }
257056
public static long saturatedMultiply(long a, long b) {
        // see checkedMultiply for explanation
        int leadingZeros = Long.numberOfLeadingZeros(a) + Long.numberOfLeadingZeros(~a) + Long.numberOfLeadingZeros(b) + Long.numberOfLeadingZeros(~b);
        if (leadingZeros > Long.SIZE + 1) {
            return a * b;
        }
        // the return value if we will overflow (which we calculate by overflowing a long :) )
        long limit = Long.MAX_VALUE + ((a ^ b) >>> (Long.SIZE - 1));
        if (leadingZeros < Long.SIZE | (a < 0 & b == Long.MIN_VALUE)) {
            // overflow
            return limit;
        }
        long result = a * b;
        if (a == 0 || result / a == b) {
            return result;
        }
        return limit;
    }
183561
public static <A extends Number & Comparable<?>> NumberExpression<A> max(Expression<A> left, Expression<A> right) {
        return NumberExpression.max(left, right);
    }
556644
public static int max(int a, int b, int c) {
    int ma;
    ma = a;
    if (b > ma) {
      ma = b;
    }
    if (c > ma) {
      ma = c;
    }
    return ma;
  }
1172281
@Override
  public Double max11(Double arg1, Double arg2) {
    if (arg1 == null || arg2 == null) {
      return Double.NaN;
    } else {
      return Math.max(arg1, arg2);
    }
  }
168586
public static double elementMax( DMatrix3 a ) {
        double max = a.a1;
        if( a.a2 > max ) max = a.a2;
        if( a.a3 > max ) max = a.a3;

        return max;
    }
78061
public static float max(final float a, final float b) {
        if (a > b) {
            return a;
        }
        if (a < b) {
            return b;
        }
        /* if either arg is NaN, return NaN */
        if (a != b) {
            return Float.NaN;
        }
        /* min(+0.0,-0.0) == -0.0 */
        /* 0x80000000 == Float.floatToRawIntBits(-0.0d) */
        int bits = Float.floatToRawIntBits(a);
        if (bits == 0x80000000) {
            return b;
        }
        return a;
    }
508337
public static NumericalValue intersect (final NumericalValue a, final NumericalValue b) {
        // early exit
        if (a == null || b == null) return null;
        // get ranges of a and b
        int aMin, aMax, bMin, bMax;
        if (a instanceof SingleNumericalValue) {
            final SingleNumericalValue v = (SingleNumericalValue) a;
            aMin = v.getValue();
            aMax = aMin;
        } else {
            final NumericalValueRange r = (NumericalValueRange) a;
            aMin = r.getMin();
            aMax = r.getMax();
        }
        if (b instanceof SingleNumericalValue) {
            final SingleNumericalValue v = (SingleNumericalValue) b;
            bMin = v.getValue();
            bMax = bMin;
        } else {
            final NumericalValueRange r = (NumericalValueRange) b;
            bMin = r.getMin();
            bMax = r.getMax();
        }
        // intersect ranges
        final int min = Math.max(aMin, bMin);
        final int max = Math.min(aMax, bMax);
        if (min == max)
            return SingleNumericalValue.create(min);
        else
            return NumericalValueRange.create(min, max);
    }
465032
public static double elementMaxAbs( DMatrix2x2 a ) {
        double max = Math.abs(a.a11);
        double tmp = Math.abs(a.a12); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a21); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a22); if( tmp > max ) max = tmp;

        return max;
    }
501386
@Pure
	public static int max(int... values) {
		if (values == null || values.length == 0) {
			return 0;
		}
		int max = values[0];
		for (final int v : values) {
			if (v > max) {
				max = v;
			}
		}
		return max;
	}
807754
public static int findMaxIndex( int[] a ) {
		int max = a[0];
		int index = 0;

		for( int i = 1; i< a.length; i++ ) {
			int val = a[i];

			if( val > max ) {
				max = val;
				index = i;
			}
		}

		return index;
	}