modified java snippet break