Kolmogorov-Smirnov two-sample test The Suanshu Statistics Library supports the "Kolmogorov-Smirnov two-sample test" by rejecting the null hypothesis if $p$-value if smaller than significance level  $\alpha$ (e.g., $p<0.05$).
My question is whether there is any method to check if the "test statistic" exceeds the critical value (for $\alpha = 0.05$) to reject the "null hypothesis" in Suanshu Library or any other statistics library?. If not, is there any formula to compute the critical values by ourself for two-sample K-Smirnov test to check against test statistic.
Any suggestions regarding this are welcome.
 A: I am assuming you are asking because the Suanshu help page reports in reference to the K-S distribution, "This is not done yet." Luckily, it is very easy to do in R. If x and y are your two samples, ks.test(x,y) returns the test statistic and pvalue. For example,
> x <- rnorm(50)
> y <- runif(30)
> ks.test(x, y)    
        Two-sample Kolmogorov-Smirnov test    
data:  x and y 
D = 0.5, p-value = 9.065e-05
alternative hypothesis: two-sided

By default, it will compute exact or asymptotic p-values based on the product of the sample sizes (exact p-values for n.x*n.y < 10000 in the two-sample case), or you can specify this option with a third argument, exact=F or exact=T. Exact p-values are calculated using the methods of Marsaglia, et al. (2003), which the Suanshu documentation also cites. Some large sample approximations are given here, although I don't have a proper citation. Lastly, if you don't want to install R, there are web calculators for the two-sample K-S test, although I don't know if they use the same algorithm as R because the one I found only reported three decimal points for the p-value.
A: SuanShu's Kolmogorov-Smirnov package can do anything R can do. The software computes both D, and p-values, just exactly in R. You can then use p-value to compare with whatever critical value threshold you want. In fact, SuanShu gives you the whole K-S distributions for different cases.
In addition, as pointed out in R's help page, R code does not handle duplicates. In this case, SuanShu is more precise in cases where there are duplicates. 
See the examples here:
http://redmine.numericalmethod.com/projects/public/repository/entry/Examples/src/main/java/com/numericalmethod/suanshu/examples/HypothesisTesting.java
https://github.com/nmdev2020/SuanShu
https://nm.dev
