I dont write a example for Mental Command with Training profile on Java yet. but you can read it on other languages. i think you can be easy to read and create it in Java. ^^!
https://github.com/Emotiv/community-sdk/blob/master/examples/C%23/MentalCommandWithCloudProfile/Program.cs
https://github.com/Emotiv/community-sdk/blob/master/examples/C%2B%2B/MentalCommandWithCloudProfile/MentalCommandWithCloudProfile.cpp