Can't help you with Java but to print a certain row on every sheet you can certainly get a header row (or rows) at the top of every page:
Menu: Page setup / sheet / Row to repeat at top / use the little square to go to the sheet and select the row / hit okay
If you want to see this code in VBA use the macro recorder - I've used recorded code to do this and its a little slow but works.
Regards.