Refactored Java version of libSVM