I have recently faced this question in a practical test for a job .
Suppose you are given a flat data structure like this :
**Category** **Name**
Using your ArrayList as input a recursive method will be needed to print all nodes in a hierarchical/tree representation.
If you are not using recursion then this might be the reason that you cannot go to levels greater than the second one, that you mention.
Some links on recursion:
http://en.wikipedia.org/wiki/Recursion
http://www.java-samples.com/showtutorial.php?tutorialid=151