(java) Solved problem 19
(java) Solved problem 20