I forgot the function in Java to calculate the magnitude of an integer. help please..
|5| = +5 = 5
|-5| = +5 = 5
so if a - b is - x
mag (a - b) is x a posstive number..
I believe you are looking for Math.abs(). Using this function:
5 = Math.abs(5) = Math.abs(-5)
Try Math.abs.
abs(-4) = 4;
abs(5) = 5;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With