Math.absLong()

Signature

long absLong (long a)

Domain

action, condition

Description

Returns the absolute value of a long value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Note that if the argument is equal to the value of Long.MIN_VALUE, the most negative representable long value, the result is that same value, which is negative.

Parameters

NameTypeDescription
alongThe argument whose absolute value is to be determined.

Returns

TypeDescription
longThe absolute value of the argument.

Cautions

none

See Also

java.lang.Long#MIN_VALUE

Example


String result = String.valueOfLong (Math.absLong (-34L));

Result is: result contains: "34"