Hunter的大杂烩

July 6, 2012

Excel中的部分统计函数 的Java实现

Filed under: 技术话题 — hunter @ 7:11 pm

部分参考: http://blog.csdn.net/peakryuu/article/details/6180711

               http://derpvail.iteye.com/blog/260992

不过两个出处都有些小bug,经过修正后如下:
public class StatisticalFunction {
 public static double max(double[] p){
  if (p.length == 0)
   throw new IllegalArgumentException();
  int len = p.length;
  double max = p[0];
  for (int i = 0; i < len; i++) {    if (max < p[i])     max = p[i];   }   return max;  } (more…)

Powered by WordPress