Replace Recursion with Iteration. Recursion is often used without considering alternatives before using it. Though it is true that recursive solution is often more elegant and easier to spot than the iterative solution, one should take care not to abuse it. Moreover, iterative solutions are usually more efficient than recursive solutions as they don't incur the overhead of the multiple method calls. We use Recursion when we have to perform a complex task that can be broken into the several subtasks.
Recursion is implemented as a method that calls itself to solve subtasks.
During the recursive call the values of the local fields of the method are placed on the method stack until the subtask performed by a recursive call is completed. Thus, whenever recursive method is called, local fields are put on the method stack and used again after the recursive call is completed. Sometimes a recursive solution doesn't preserve any local fields during the recursive call, which makes Refactoring much easier. This is the case with, so called, tail recursions. Tail recursions are recursions where the recursive call is the last line in the method.