public static double fTestValueGivenFprob(double fProb, int df1, int df2) {

		// Create an array F-test value array
		int fTestsNum = 100; // length of array
		double[] fTestValues = new double[fTestsNum];
		fTestValues[0] = 0.0001D; // lowest array value
		fTestValues[fTestsNum - 1] = 10000.0D; // highest array value
		// calculate array increment - log scale
		double diff = (Fmath.log10(fTestValues[fTestsNum - 1]) - Fmath.log10(fTestValues[0])) / (fTestsNum - 1);
		// Fill array
		for (int i = 1; i < fTestsNum - 1; i++) {
			fTestValues[i] = Math.pow(10.0D, (Fmath.log10(fTestValues[i - 1]) + diff));
		}

		// calculate F test probability array corresponding to F-test value array
		double[] fTestProb = new double[fTestsNum];
		for (int i = 0; i < fTestsNum; i++) {
			fTestProb[i] = Stat.fTestProb(fTestValues[i], df1, df2);
		}

		// calculate F-test value for provided probability
		// using bisection procedure
		double fTest0 = 0.0D;
		double fTest1 = 0.0D;
		double fTest2 = 0.0D;

		// find bracket for the F-test probabilities and calculate F-Test value from above arrays
		boolean test0 = true;
		boolean test1 = true;
		int i = 0;
		int endTest = 0;
		while (test0) {
			if (fProb == fTestProb[i]) {
				fTest0 = fTestValues[i];
				test0 = false;
				test1 = false;
			} else {
				if (fProb > fTestProb[i]) {
					test0 = false;
					if (i > 0) {
						fTest1 = fTestValues[i - 1];
						fTest2 = fTestValues[i];
						endTest = -1;
					} else {
						fTest1 = fTestValues[i] / 10.0D;
						fTest2 = fTestValues[i];
					}
				} else {
					i++;
					if (i > fTestsNum - 1) {
						test0 = false;
						fTest1 = fTestValues[i - 1];
						fTest2 = 10.0D * fTestValues[i - 1];
						endTest = 1;
					}
				}
			}
		}

		// call bisection method
		if (test1) fTest0 = fTestBisect(fProb, fTest1, fTest2, df1, df2, endTest);

		return fTest0;
	}