Java rewrite engine4