double[] values = new double[] ...{ 0.33, 1.33, 0.27333, 0.3, 0.501, 0.444, 0.44, 0.34496, 0.33, 0.3, 0.292, 0.667 }; /**//* * System.out.println( "min: " + StatUtils.min( values ) ); * System.out.println( "max: " + StatUtils.max( values ) ); * System.out.println( "mean: " + StatUtils.mean( values ) ); // Returns * the arithmetic mean of the entries in the input array, or Double.NaN * if the array is empty System.out.println( "product: " + * StatUtils.product( values ) ); //Returns the product of the entries * in the input array, or Double.NaN if the array is empty. * System.out.println( "sum: " + StatUtils.sum( values ) ); //Returns * the sum of the values in the input array, or Double.NaN if the array * is empty. System.out.println( "variance: " + StatUtils.variance( * values ) ); // Returns the variance of the entries in the input * array, or Double.NaN if the array is empty. */
Min min = new Min(); Max max = new Max(); Mean mean = new Mean(); // 算术平均值 Product product = new Product(); Sum sum = new Sum(); Variance variance = new Variance(); System.out.println("min: " + min.evaluate(values)); System.out.println("max: " + max.evaluate(values)); System.out.println("mean: " + mean.evaluate(values)); System.out.println("product: " + product.evaluate(values)); System.out.println("sum: " + sum.evaluate(values)); System.out.println("variance: " + variance.evaluate(values));