Math: abs(int value)
/* * Output: Absolute value of -18 is 18 */ public class MainClass { public static void main(String args[]) { System.out.println("Absolute value of -18 is " + Math.abs(-18)); } }