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
Comments are closed. Join the conversation on LinkedIn.
Thanks, you saved my day…
many many thanks
Nice one
thanks
Thanks, was really useful.
useful, thanks!
Thanks! very simple and it works!
Thank you!!