Add solution of Cleaning Up problem in java