Some of UVA problem solution solved in java