/** * 取一个数组中最小的值 * * @param array * @return */ public static Number min(Number... array) { Number min = array[0]; for (int i = 1; i < array.length; i++) { min = NumberOperator.min(array[i], min); } return min; }
/** * 统计求和 * * @param array * @return */ public static Number sum(Number[] array) { Number sum = 0; for (Number each : array) { sum = NumberOperator.add(sum, each); } return sum; }
/** * 取一个数组中最大的值 * * @param array * @return */ public static Number max(Number... array) { Number max = array[0]; for (int i = 1; i < array.length; i++) { max = NumberOperator.max(array[i], max); } return max; }
/** * 求平均数 * * @param array * @return */ public static double average(Number[] array) { return NumberOperator.divide(sum(array), array.length).doubleValue(); }