Package com.jidesoft.utils
Class BigDecimalMathUtils
java.lang.Object
com.jidesoft.utils.BigDecimalMathUtils
A collection of several util methods related to BigDecimal. We only used it in BigDecimalSummaryCalculator in JIDE
Pivot Grid. but this class will be reserved as a place holder for methods related to BigDecimal.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic BigDecimalmax(List<BigDecimal> numbers) Returns the max number in the numbers list.static BigDecimalmean(List<BigDecimal> numbers, MathContext context) Returns the mean number in the numbers list.static BigDecimalmin(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 BigDecimalsqrt(BigDecimal number) Calcualtes the square root of the number.static BigDecimalstddev(List<BigDecimal> numbers, boolean biasCorrected, MathContext context) Returns the standard deviation of the numbers.static BigDecimalsum(List<BigDecimal> numbers) Returns the sum number in the numbers list.static BigDecimalvar(List<BigDecimal> numbers, boolean biasCorrected, MathContext context) Computes the variance of the available values.
-
Field Details
-
TWO
-
-
Constructor Details
-
BigDecimalMathUtils
protected BigDecimalMathUtils()
-
-
Method Details
-
sum
Returns the sum number in the numbers list.- Parameters:
numbers- the numbers to calculate the sum.- Returns:
- the sum of the numbers.
-
mean
Returns the mean number in the numbers list.- Parameters:
numbers- the numbers to calculate the mean.context- the MathContext.- Returns:
- the mean of the numbers.
-
min
Returns the min number in the numbers list.- Parameters:
numbers- the numbers to calculate the min.- Returns:
- the min number in the numbers list.
-
max
Returns the max number in the numbers list.- Parameters:
numbers- the numbers to calculate the max.- Returns:
- the max number in the numbers list.
-
range
Returns the max number in the numbers list.- Parameters:
numbers- the numbers to calculate the max.- Returns:
- the max number in the numbers list.
-
stddev
public static BigDecimal stddev(List<BigDecimal> numbers, boolean biasCorrected, MathContext context) Returns the standard deviation of the numbers. Double.NaN is returned if the numbers list is empty.- Parameters:
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 MathContext- Returns:
- the standard deviation
-
var
Computes the variance of the available values. By default, the unbiased "sample variance" definitional formula is used: variance = sum((x_i - mean)^2) / (n - 1) The "population variance" ( sum((x_i - mean)^2) / n ) can also be computed using this statistic. ThebiasCorrectedproperty determines whether the "population" or "sample" value is returned by theevaluateandgetResultmethods. To compute population variances, set this property tofalse.- Parameters:
numbers- the numbers to calculate the variance.biasCorrected- true if variance is calculated by dividing by n - 1. False if by n.context- the MathContext- Returns:
- the variance of the numbers.
-
sqrt
Calcualtes the square root of the number.- Parameters:
number- the input number.- Returns:
- the square root of the input number.
-
main
-