Java BigDecimal is negative? 2

Posted by Jens on September 25, 2009

To check if a BigDecimal in Java is negative use the signum() method like it’s shown in the following snippet:

  1.     public static boolean isNegative(BigDecimal b)
  2.     {
  3.         b.signum() == -1;
  4.     }
Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. will Fri, 19 Mar 2010 02:02:58 CET

    Thanks, you saved my day…

  2. sats Thu, 24 Mar 2011 17:25:39 CET

    many many thanks

Comments