类 MathUtil
- java.lang.Object
-
- cn.vorbote.commons.MathUtil
-
public final class MathUtil extends Object
This util class can make some formal calculation.
-
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static doubleAverage(Collection<? extends Number> numbers)Get the average value of the numbersstatic longFactorial(int n)Calc the factorial of nstatic booleanIsBetween(Number num, Number noLess, Number noGreater)Check the num whether is between the noLess and noGreater numberstatic doubleSum(Collection<? extends Number> numbers)Get the sum of the numbers
-
-
-
方法详细资料
-
Factorial
public static long Factorial(int n)
Calc the factorial of n- 参数:
n- The number N should greater or equal to 0- 返回:
- The result of factorial n
- 抛出:
RuntimeException- The n should greater or equal to 0
-
Sum
public static double Sum(Collection<? extends Number> numbers)
Get the sum of the numbers- 参数:
numbers- The numbers- 返回:
- The sum value of the numbers
-
Average
public static double Average(Collection<? extends Number> numbers)
Get the average value of the numbers- 参数:
numbers- The numbers- 返回:
- The average value of the numbers
-
-