This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Test for negative long?

 
myron schabe
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I test if a long is a negative rather than positive value?
 
Rodney Woodruff
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic