Add original Java source files for clustering.

Adding them so that they can be used for reference when porting.
Once they're ported, the Java files can be removed.
Finish porting the unit tests.
Fix race condition with one of the tests.