c done, and java working correctly as well