StrictMath.abs(long a) has the following syntax.
public static long abs(long a)
In the following code shows how to use StrictMath.abs(long a) method.
public class Main { //from w ww . j a v a 2s .c o m public static void main(String[] args) { long l1 = 12345678909876L, l2 = -12345678909876L; // returns the absolute value of positive long value long lAbsValue = StrictMath.abs(l1); System.out.println("absolute value of " + l1 + " = " + lAbsValue); // returns the absolute value of negative long value lAbsValue = StrictMath.abs(l2); System.out.println("absolute value of " + l2 + " = " + lAbsValue); } }
The code above generates the following result.