Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BigDecimal question

 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to check if the BigDecimal value is positive or negative. How can i do that? I didn't find any method which does this in the API.

Thanks,
Srikanth.
 
Campbell Ritchie
Sheriff
Posts: 48407
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the compareTo method and pass BigDecimal.ZERO.
 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ritchie it worked!
 
Campbell Ritchie
Sheriff
Posts: 48407
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic