Sample solutions in java