Top Constructors Methods
org.eclipse.jetty.util

public Class MathUtils

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static long

Returns:

the sum of the values, capped to Long#MAX_VALUE
cappedAdd
(long
the first value
a
,
long
the second value
b
)

Returns the sum of its arguments, capping to Long#MAX_VALUE if they overflow.

public static int

Returns:

the sum of the values, capped to maxValue
cappedAdd
(int
the first value
a
,
int
the second value
b
,
int maxValue)

Returns the sum of its arguments, capping to maxValue.

public static boolean

Returns:

whether the sum of the arguments overflows an int
sumOverflows
(int
the first value
a
,
int
the second value
b
)

Returns whether the sum of the arguments overflows an int.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MathUtilsback to summary
private MathUtils()

Method Detail

cappedAddback to summary
public static long cappedAdd(long a, long b)

Returns the sum of its arguments, capping to Long#MAX_VALUE if they overflow.

Parameters
a:long

the first value

b:long

the second value

Returns:long

the sum of the values, capped to Long#MAX_VALUE

cappedAddback to summary
public static int cappedAdd(int a, int b, int maxValue)

Returns the sum of its arguments, capping to maxValue.

Parameters
a:int

the first value

b:int

the second value

Returns:int

the sum of the values, capped to maxValue

sumOverflowsback to summary
public static boolean sumOverflows(int a, int b)

Returns whether the sum of the arguments overflows an int.

Parameters
a:int

the first value

b:int

the second value

Returns:boolean

whether the sum of the arguments overflows an int