refactor in Java