Primitive Recursive Function In Java