how-to

Math

How to compute absolute value

For computing use static method from java.lang.Math:

double d1 = Math.abs( -25.5 );
double d2 = Math.abs( 25.5 );

System.out.println( d1 );
System.out.println( d2 );

The output will be:

25.5
25.5