[Logo]
Forums Register Login
convert Postiive number to negative..
Is there any prebuilt function in java that convert positive number to negative number ??
eg, abs() convert negative to positive.. .



something like that ? (and you can write it even shorter ...)

pascal
Unary operator -
int pos = 10;
int neg = -pos;
if you want to guarantee a negative number

Math.abs(number) * -1
 

Originally posted by Michael Dunn:
if you want to guarantee a negative number

Math.abs(number) * -1



Another smart (and handsome) rancher also suggested this here
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards


This thread has been viewed 26139 times.

All times above are in ranch (not your local) time.
The current ranch time is
Sep 20, 2018 09:22:43.