public class BigDecimalHelper
extends java.lang.Object
BigDecimals.| Modifier and Type | Field and Description |
|---|---|
static java.math.MathContext |
MATH_CONTEXT
A math context with precision = 15 +
MAX_SCALE, with RoundingMode.HALF_UP |
static int |
MAX_SCALE |
static java.math.BigDecimal |
ONE_HUNDRED |
| Constructor and Description |
|---|
BigDecimalHelper() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areEquals(java.math.BigDecimal bd1,
java.math.BigDecimal bd2) |
static int |
compareTo(java.math.BigDecimal bd1,
java.math.BigDecimal bd2) |
static int |
hashCode(java.math.BigDecimal bd1) |
static boolean |
isNegative(java.math.BigDecimal number)
Returns whether the given number is a negative, non-zero number, given a precision delta
|
static boolean |
isNegativeOrZero(java.math.BigDecimal number)
Returns whether the given number is a negative or zero number, given a precision delta
|
static boolean |
isPositive(java.math.BigDecimal number)
Returns whether the given number is a positive, non-zero number, given a precision delta
|
static boolean |
isPositiveOrZero(java.math.BigDecimal number)
Returns whether the given number is a positive or zero number, given a precision delta
|
static boolean |
isZero(java.math.BigDecimal number)
Returns whether the given number is a negative, non-zero number, given a precision delta
|
static java.math.BigDecimal |
max(java.math.BigDecimal bd1,
java.math.BigDecimal bd2) |
static java.math.BigDecimal |
min(java.math.BigDecimal bd1,
java.math.BigDecimal bd2) |
static java.math.BigDecimal |
round(java.math.BigDecimal number,
int scale)
Rounds the given number to the given scale
|
static java.math.BigDecimal |
toBigDecimal(java.lang.String intPart,
java.lang.String decimalPart)
Converts the given integer part and decimal part to a BigDecimal value.
|
static java.math.BigDecimal |
zeroWhenNull(java.math.BigDecimal bigDecimal)
Returns zero when the given BigDecimal is null
|
public static final java.math.BigDecimal ONE_HUNDRED
public static final int MAX_SCALE
public static final java.math.MathContext MATH_CONTEXT
MAX_SCALE, with RoundingMode.HALF_UPpublic static boolean areEquals(java.math.BigDecimal bd1,
java.math.BigDecimal bd2)
public static int compareTo(java.math.BigDecimal bd1,
java.math.BigDecimal bd2)
public static int hashCode(java.math.BigDecimal bd1)
public static boolean isNegative(java.math.BigDecimal number)
public static boolean isNegativeOrZero(java.math.BigDecimal number)
public static boolean isPositive(java.math.BigDecimal number)
public static boolean isPositiveOrZero(java.math.BigDecimal number)
public static boolean isZero(java.math.BigDecimal number)
public static java.math.BigDecimal max(java.math.BigDecimal bd1,
java.math.BigDecimal bd2)
public static java.math.BigDecimal min(java.math.BigDecimal bd1,
java.math.BigDecimal bd2)
public static java.math.BigDecimal round(java.math.BigDecimal number,
int scale)
public static java.math.BigDecimal toBigDecimal(java.lang.String intPart,
java.lang.String decimalPart)
public static java.math.BigDecimal zeroWhenNull(java.math.BigDecimal bigDecimal)