Reorg java code