public final class BigDecimalMathUtils extends Object
Modifier and Type | Field and Description |
---|---|
static BigDecimal |
TWO |
Modifier | Constructor and Description |
---|---|
protected |
BigDecimalMathUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args) |
static BigDecimal |
max(List<BigDecimal> numbers)
Returns the max number in the numbers list.
|
static BigDecimal |
mean(List<BigDecimal> numbers,
MathContext context)
Returns the mean number in the numbers list.
|
static BigDecimal |
min(List<BigDecimal> numbers)
Returns the min number in the numbers list.
|
static Range<BigDecimal> |
range(List<BigDecimal> numbers)
Returns the max number in the numbers list.
|
static BigDecimal |
sqrt(BigDecimal number)
Calcualtes the square root of the number.
|
static BigDecimal |
stddev(List<BigDecimal> numbers,
boolean biasCorrected,
MathContext context)
Returns the standard deviation of the numbers.
|
static BigDecimal |
sum(List<BigDecimal> numbers)
Returns the sum number in the numbers list.
|
static BigDecimal |
var(List<BigDecimal> numbers,
boolean biasCorrected,
MathContext context)
Computes the variance of the available values.
|
public static final BigDecimal TWO
public static BigDecimal sum(List<BigDecimal> numbers)
numbers
- the numbers to calculate the sum.public static BigDecimal mean(List<BigDecimal> numbers, MathContext context)
numbers
- the numbers to calculate the mean.context
- the MathContext.public static BigDecimal min(List<BigDecimal> numbers)
numbers
- the numbers to calculate the min.public static BigDecimal max(List<BigDecimal> numbers)
numbers
- the numbers to calculate the max.public static Range<BigDecimal> range(List<BigDecimal> numbers)
numbers
- the numbers to calculate the max.public static BigDecimal stddev(List<BigDecimal> numbers, boolean biasCorrected, MathContext context)
numbers
- the numbers to calculate the standard deviation.biasCorrected
- true if variance is calculated by dividing by n - 1. False if by n. stddev is a sqrt of the
variance.context
- the MathContextpublic static BigDecimal var(List<BigDecimal> numbers, boolean biasCorrected, MathContext context)
biasCorrected
property determines whether the "population" or "sample" value is returned by the
evaluate
and getResult
methods. To compute population variances, set this property to
false
.numbers
- the numbers to calculate the variance.biasCorrected
- true if variance is calculated by dividing by n - 1. False if by n.context
- the MathContextpublic static BigDecimal sqrt(BigDecimal number)
number
- the input number.public static void main(String[] args)