LibFM conversion from C++ to Java