machine learning project re-write in java