How to find absolute value of long in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        long x = -948392;
        
        long result = Math.abs(x);

        System.out.println(result);
    }
}



/*
run:

948392

*/

 



answered Aug 5, 2020 by avibootz

Related questions

1 answer 194 views
1 answer 220 views
220 views asked Aug 5, 2020 by avibootz
1 answer 310 views
1 answer 249 views
1 answer 240 views
1 answer 243 views
243 views asked Jun 29, 2015 by avibootz
...