java: utility method extracted