Java BigDecimal Value Check isZero(final BigDecimal value)

Here you can find the source of isZero(final BigDecimal value)

Description

is Zero

License

Apache License

Return

true if value !=null and 0.

Declaration

public static boolean isZero(final BigDecimal value) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

public class Main {
    /**/*from   w  w w.j a  v a2s  . c om*/
     * @return true if value !=null and 0.
     */
    public static boolean isZero(final BigDecimal value) {
        return value != null && value.signum() == 0;
    }

    /**
     * If value is null return 0 otherwise the signum().
     * 
     * @param value
     * @return
     */
    public static int signum(final BigDecimal value) {
        return value == null ? 0 : value.signum();
    }
}

Related

  1. isZero(BigDecimal bd)
  2. isZero(BigDecimal d)
  3. isZero(BigDecimal decimal)
  4. isZero(BigDecimal inValue)
  5. isZero(final BigDecimal b)
  6. isZeroOrNull(final BigDecimal value)