[Java] Minor refactoring