[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



All times above are in ranch (not your local) time.
The current ranch time is
Nov 21, 2017 01:05:41.