Class MathUtils

java.lang.Object
org.eclipse.jetty.util.MathUtils

public class MathUtils extends Object
  • Constructor Details

    • MathUtils

      private MathUtils()
  • Method Details

    • sumOverflows

      public static boolean sumOverflows(int a, int b)
      Returns whether the sum of the arguments overflows an int.
      Parameters:
      a - the first value
      b - the second value
      Returns:
      whether the sum of the arguments overflows an int
    • cappedAdd

      public static long cappedAdd(long a, long b)
      Returns the sum of its arguments, capping to Long.MAX_VALUE if they overflow.
      Parameters:
      a - the first value
      b - the second value
      Returns:
      the sum of the values, capped to Long.MAX_VALUE