Java #3: Solution