Added a condition to the java file.