Solved UVA programming problems using Java