There is a wonderfull Java/Eclipse feature called scrapbook:
The scrapbook allows Java expressions, to be run, inspected, and displayed under the control of the debugger. Breakpoints and exceptions behave as they do in a regular debug session… Code is edited on a scrapbook page…
- Create a file with a .jpage extension
- From the menu bar, select File > New > Other. Then select Java > Java Run/Debug > Scrapbook Page. Then click Next.
In the scrapbook page, either type an expression or highlight an existing expression to be inspected.
- Inspecting shows the result of evaluating an expression in the Expressions view.
- Displaying shows the result of evaluating an expression in the scrapbook editor.
- Executing an expression evaluates an expression but does not display a result.
(taken from Java Development User Guide -> Using the scrapbook)