playing with a rewrite in JAVA