java code. trained new model\