Added java-based solution for exercise 3