float a = 123.0f; System.out.println(Math.abs(a)); //123.0 double d = -999.3456; System.out.println(Math.abs(d)); //999.3456 int e = -123; System.out.println(Math.abs(g)); //123 long g = -12345678; System.out.println(Math.abs(g)); //12345678