I was wondering if there is a good statistical library for Java. I used to use colt from CERN but it does not provide a good weighted sampling. So I usually use MATLAB Java Builder and export everything to Java afterward. Any thoughts or insights?
13

javastatistics

5

I asked a similar question over here. Some of the leading contenders in those responses include Apache Commons Math, Java Numerics (NIST), colt, and MATLIB. Currently, we're using Apache Commons Math but our penetration there isn't very deep (and we are almost certainly not using it in the same way as you would). 
4

You can also use R and call it from Java with JRI. See this related post. The downside is the learning curve, but it's well worth the effort in my opinion. As the wikipedia article states: "The R language has become a de facto standard among statisticians for the development of statistical software, and is widely used for statistical software development and data analysis." You can also follow along with the SO postings on R. See this post as an example for learning the language. 
2

jHepWork is a good statistical package in Java. Look at http://jwork.org/jhepwork/ It has good documentation, graphics and IDE (seems even for smallscreen devices) 
1

you might want to look into Octave  I don't have much experience with it, it's "kind of" compatible with MATLAB and I believe it has the ability to be called from Java. (it's GPL so be sure to check whether your use of it through Java imposes GPLness onto your application. I would guess not but do your due diligence.) 