Math.absInt()

Signature

int absInt (int a)

Domain

action, condition

Description

Returns the absolute value of an int 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 Integer.MIN_VALUE, the most negative representable int value, the result is that same value, which is negative.

Parameters

NameTypeDescription
aintThe argument whose absolute value is to be determined.

Returns

TypeDescription
intThe absolute value of the argument.

Cautions

none

See Also

java.lang.Integer#MIN_VALUE

Example


String result = String.valueOfInt (Math.absInt (-34));

Result is: result contains: "34"