java.lang.Object
org.seppiko.commons.utils.MathUtil
Math Util
- Author:
- Leonard Woo
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleavgDecimal(List<BigDecimal> nums) BigDecimal list avg numberstatic BigDecimalavgDecimal(List<BigDecimal> nums, RoundingMode roundingMode) BigDecimal list avg numberstatic BigDecimalavgInteger(List<BigInteger> nums, RoundingMode roundingMode) BigInteger list avg numberstatic StringconvertDecimalTo(long num, char[] alphabet) Convert decimal to alphabet numberstatic LongconvertToDecimal(CharSequence num, char[] alphabet) Convert alphabet number to decimalstatic BigDecimalmaxDecimal(List<BigDecimal> nums) BigDecimal list max numberstatic BigIntegermaxInteger(List<BigInteger> nums) BigInteger list max numberstatic BigDecimalminDecimal(List<BigDecimal> nums) BigDecimal list min numberstatic BigIntegerminInteger(List<BigInteger> nums) BigInteger list min numberstatic BigDecimalpow(double a, int b) Returns the value of the first argument raised to the power of the second argument.static BigIntegerpow(int a, int b) Returns the value of the first argument raised to the power of the second argument.static BigIntegerpow(long a, int b) Returns the value of the first argument raised to the power of the second argument.static BigDecimalpow(BigDecimal a, int b) Returns the value of the first argument raised to the power of the second argument.static BigIntegerpow(BigInteger a, int b) Returns the value of the first argument raised to the power of the second argument.
-
Method Details
-
maxDecimal
BigDecimal list max number- Parameters:
nums- number list- Returns:
- maximum
- Throws:
NoSuchElementException- list is null
-
maxInteger
BigInteger list max number- Parameters:
nums- number list- Returns:
- maximum
- Throws:
NoSuchElementException- list is null
-
minDecimal
BigDecimal list min number- Parameters:
nums- number list- Returns:
- minimum
- Throws:
NoSuchElementException- list is null
-
minInteger
BigInteger list min number- Parameters:
nums- number list- Returns:
- minimum
- Throws:
NoSuchElementException- list is null
-
avgDecimal
BigDecimal list avg number- Parameters:
nums- number listroundingMode- RoundingMode- Returns:
- average
-
avgDecimal
BigDecimal list avg number- Parameters:
nums- number list- Returns:
- average double
- Throws:
NoSuchElementException- list is null
-
avgInteger
BigInteger list avg number- Parameters:
nums- number listroundingMode- RoundingMode- Returns:
- average
-
pow
Returns the value of the first argument raised to the power of the second argument.- Parameters:
a- the base.b- the exponent.- Returns:
- the value
ab.
-
pow
Returns the value of the first argument raised to the power of the second argument.- Parameters:
a- the base.b- the exponent.- Returns:
- the value
ab.
-
pow
Returns the value of the first argument raised to the power of the second argument.- Parameters:
a- the base.b- the exponent.- Returns:
- the value
ab.
-
pow
Returns the value of the first argument raised to the power of the second argument.- Parameters:
a- the base.b- the exponent.- Returns:
- the value
ab.
-
pow
Returns the value of the first argument raised to the power of the second argument.- Parameters:
a- the base.b- the exponent.- Returns:
- the value
ab.
-
convertDecimalTo
Convert decimal to alphabet number- Parameters:
num- number (greater than 0)alphabet- alphabet- Returns:
- alphabet base, if num lass than 1 will return null
-
convertToDecimal
Convert alphabet number to decimal- Parameters:
num- numberalphabet- alphabet- Returns:
- if return null than num parser failed
-