Use an IDE (NetBeans, Eclipse) and step through during the execution of the code.