Please check out this site:
http://sujitpal.blogspot.com/2008/10/ir-math-in-java-experiments-in.html#ga
This would help you out with different algos and you can come up with the best as per your requirements.
solved Clustering of sentences [closed]