Package com.jidesoft.utils
Class BigDecimalMathUtils
- java.lang.Object
-
- com.jidesoft.utils.BigDecimalMathUtils
-
public final class BigDecimalMathUtils extends java.lang.ObjectA 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 Modifier and Type Field Description static java.math.BigDecimalTWO
-
Constructor Summary
Constructors Modifier Constructor Description protectedBigDecimalMathUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] args)static java.math.BigDecimalmax(java.util.List<java.math.BigDecimal> numbers)Returns the max number in the numbers list.static java.math.BigDecimalmean(java.util.List<java.math.BigDecimal> numbers, java.math.MathContext context)Returns the mean number in the numbers list.static java.math.BigDecimalmin(java.util.List<java.math.BigDecimal> numbers)Returns the min number in the numbers list.static Range<java.math.BigDecimal>range(java.util.List<java.math.BigDecimal> numbers)Returns the max number in the numbers list.static java.math.BigDecimalsqrt(java.math.BigDecimal number)Calcualtes the square root of the number.static java.math.BigDecimalstddev(java.util.List<java.math.BigDecimal> numbers, boolean biasCorrected, java.math.MathContext context)Returns the standard deviation of the numbers.static java.math.BigDecimalsum(java.util.List<java.math.BigDecimal> numbers)Returns the sum number in the numbers list.static java.math.BigDecimalvar(java.util.List<java.math.BigDecimal> numbers, boolean biasCorrected, java.math.MathContext context)Computes the variance of the available values.
-
-
-
Method Detail
-
sum
public static java.math.BigDecimal sum(java.util.List<java.math.BigDecimal> numbers)
Returns the sum number in the numbers list.- Parameters:
numbers- the numbers to calculate the sum.- Returns:
- the sum of the numbers.
-
mean
public static java.math.BigDecimal mean(java.util.List<java.math.BigDecimal> numbers, java.math.MathContext context)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
public static java.math.BigDecimal min(java.util.List<java.math.BigDecimal> numbers)
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
public static java.math.BigDecimal max(java.util.List<java.math.BigDecimal> numbers)
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
public static Range<java.math.BigDecimal> range(java.util.List<java.math.BigDecimal> numbers)
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 java.math.BigDecimal stddev(java.util.List<java.math.BigDecimal> numbers, boolean biasCorrected, java.math.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
public static java.math.BigDecimal var(java.util.List<java.math.BigDecimal> numbers, boolean biasCorrected, java.math.MathContext context)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
public static java.math.BigDecimal sqrt(java.math.BigDecimal number)
Calcualtes the square root of the number.- Parameters:
number- the input number.- Returns:
- the square root of the input number.
-
main
public static void main(java.lang.String[] args)
-
-