Some sample code to refcator in java