Class LongUtils
java.lang.Object
org.apache.jackrabbit.oak.commons.LongUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic longcalculateExpirationTime(long expiration) Calculate an expiration time based onnew Date().getTime()and the specifiedexpirationin number of milliseconds.static longsafeAdd(long a, long b) Sumsaandband verifies that it doesn't overflow in signed long arithmetic, in which caseLong.MAX_VALUEwill be returned instead of the result.
-
Method Details
-
safeAdd
public static long safeAdd(long a, long b) Sumsaandband verifies that it doesn't overflow in signed long arithmetic, in which caseLong.MAX_VALUEwill be returned instead of the result. Note: this method is a variant ofLongMath.checkedAdd(long, long)that returnsLong.MAX_VALUEinstead of throwingArithmeticException.- See Also:
-
calculateExpirationTime
public static long calculateExpirationTime(long expiration) Calculate an expiration time based onnew Date().getTime()and the specifiedexpirationin number of milliseconds.- Parameters:
expiration- The expiration in milliseconds.- Returns:
- The expiration time.
-