Java StrictMath.abs(float a)
Syntax
StrictMath.abs(float a) has the following syntax.
public static float abs(float a)
Example
In the following code shows how to use StrictMath.abs(float a) method.
public class Main {
/*from ww w . j a va 2 s . com*/
public static void main(String[] args) {
float f1 = 12, f2 = -1;
System.out.println("absolute value of " + f1 + " = " +
StrictMath.abs(f1));
System.out.println("absolute value of " + f2 + " = " +
StrictMath.abs(f2));
}
}
The code above generates the following result.