Forums Register Login

Test for negative long?

+Pie Number of slices to send: Send
How can I test if a long is a negative rather than positive value?
+Pie Number of slices to send: Send
Check to see if the long is less than zero.
Example
long myLong = -5L;
System.out.println(myLong < 0);
Prints "true" if negative.
Prints "false" if positive.
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 12515 times.
Similar Threads
>>>
abs??
Math.round() question for negative numbers
Jiris, Mock 1, Q17
increase in performance for Reverse for loop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:13:47.