Java StrictMath.abs(int a)
Syntax
StrictMath.abs(int a) has the following syntax.
public static int abs(int a)
Example
In the following code shows how to use StrictMath.abs(int a) method.
// ww w. j av a2s . c om
public class Main {
public static void main(String[] args) {
int i1 = 12 , i2 = -34;
System.out.println("absolute value of " + i1 + " = " +
StrictMath.abs(i1));
System.out.println("absolute value of " + i2 + " = " +
StrictMath.abs(i2));
}
}
The code above generates the following result.