Skip to content
Jens Jäger

Java BigDecimal is negative?

This post is part of the archive. It was written years ago, so some of the tools, versions and links may be outdated.

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

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

8 comments

  1. Thanks, you saved my day…

  2. many many thanks

  3. Rohit

    Nice one

  4. sandeep

    thanks

  5. Thanks, was really useful.

  6. Skander

    useful, thanks!

  7. Thanks! very simple and it works!

  8. SAT

    Thank you!!

Comments are closed. Join the conversation on LinkedIn.