java.lang.Object
org.eclipse.jetty.util.MathUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic longcappedAdd(long a, long b) Returns the sum of its arguments, capping toLong.MAX_VALUEif they overflow.static booleansumOverflows(int a, int b) Returns whether the sum of the arguments overflows anint.
-
Method Details
-
sumOverflows
public static boolean sumOverflows(int a, int b) Returns whether the sum of the arguments overflows anint.- Parameters:
a- the first valueb- 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 toLong.MAX_VALUEif they overflow.- Parameters:
a- the first valueb- the second value- Returns:
- the sum of the values, capped to
Long.MAX_VALUE
-