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 119 views
1 answer 143 views
143 views asked Aug 5, 2020 by avibootz
1 answer 226 views
1 answer 153 views
1 answer 169 views
1 answer 160 views
160 views asked Jun 29, 2015 by avibootz
...