Implements several different examples of recursion using java