added solutions in Java