Java BigDecimal Value Check isNullOrZero(BigDecimal number)

Here you can find the source of isNullOrZero(BigDecimal number)

Description

Utility function to check if the BigDecimal value is null or zero.

License

Open Source License

Parameter

Parameter Description
number a parameter

Return

If number is null or zero returns true, else returns false.

Declaration

public static boolean isNullOrZero(BigDecimal number) 

Method Source Code

//package com.java2s;

import java.math.BigDecimal;

public class Main {
    /**//  ww w.j a  va2 s  . co m
     * Utility function to check if the BigDecimal value is null or zero.
     * Currently being called from Util.formatMoney function above.
     * @param number
     * @return If number is null or zero returns true, else returns false.
     */
    public static boolean isNullOrZero(BigDecimal number) {
        boolean isBigDecimalValueNullOrZero = false;
        if (number == null)
            isBigDecimalValueNullOrZero = true;
        else if (number != null && number.compareTo(BigDecimal.ZERO) == 0)
            isBigDecimalValueNullOrZero = true;

        return isBigDecimalValueNullOrZero;
    }
}

Related

  1. isNotSameAbsValue(final BigDecimal v1, final BigDecimal v2)
  2. isNotZero(final BigDecimal value)
  3. isNotZeroPositive(BigDecimal value)
  4. isNull(BigDecimal bdg)
  5. isNull(final BigDecimal s)
  6. isNullOrZero(BigDecimal value)
  7. isParseableBigDecimal(String string)
  8. isPositive(BigDecimal number)
  9. isPositive(BigDecimal value)