[Java]: Fix warning and checkstyle violations.