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 113 views
1 answer 140 views
140 views asked Aug 5, 2020 by avibootz
1 answer 223 views
1 answer 149 views
1 answer 165 views
1 answer 158 views
158 views asked Jun 29, 2015 by avibootz
...