Added collatz algorithm solution in Java.