Hello, I am writing a program for statistics and am don't have a very in depth knowledge of p value; I understand what it is so maybe it is that I don't understand cumulative probability and how it gets me a T Value. I've only taken elementary statistics years ago. From the code I can draw conclusions but I need to make sure it's right first.

I need help understanding if these methods would work for all inputs. This is mainly just due diligence because of my lack of understanding of the subject. I had to work backwards by taking answers and comparing them with negative and positive t values and 0 to write the code below and finding that you could do this from some post somewhere (I'm cheating!).

Also, am I correct in assuming that for a Z test you would simply use normal distribution for this?

Code:

```
public double getPLessThan(double DF, double tValue) {
TDistribution t = new TDistribution(DF);
double a = (t.cumulativeProbability(tValue));
return a;
}
public double getPMoreThan(double DF, double tValue) {
TDistribution t = new TDistribution(DF);
double a = (1-t.cumulativeProbability(tValue));
return a;
}
public double getPTwoTailed(double DF, double tValue) {
if (tValue > 0) {
TDistribution t = new TDistribution(DF);
double a = (1-t.cumulativeProbability(tValue));
return a*2;
} else {
TDistribution t = new TDistribution(DF);
double a = (t.cumulativeProbability(tValue));
return a*2;
}
}
```