code: public static double ChisquareInverseCdf(double p, int df)
      {
          final double CHI_EPSILON = 0.000001;   /* Accuracy of critchi approximation */
          final double CHI_MAX = 99999.0;        /* Maximum chi-square value */
          double minchisq = 0.0;
          double maxchisq = CHI_MAX;
          double chisqval = 0.0;
  
          if (p <= 0.0)
          {
              return CHI_MAX;
          }
          else if (p >= 1.0)
          {
              return 0.0;
          }
  
          chisqval = df / Math.sqrt(p);    /* fair first value */
          while ((maxchisq - minchisq) > CHI_EPSILON)
          {
              if (1 - ChisquareCdf(chisqval, df) < p)
              {
                  maxchisq = chisqval;
              }
              else
              {
                  minchisq = chisqval;
              }
              chisqval = (maxchisq + minchisq) * 0.5;
          }
  
          return chisqval;
      }
docs: 给定卡方分布的p值和自由度，返回卡方值。内部采用二分搜索实现，移植自JS代码：
  http://www.fourmilab.ch/rpkp/experiments/analysis/chiCalc.js
  
  @param p  p值（置信度）
  @param df
  @return