You have to either create a formula cell and insert the formula to sum up the cells up to 33 (or better to current cell number minus one), or write the sum to cell 34 as value.
In the latter case you can perform the calculation in your Java code or use a database query to get it.
For the formula you have to know the Excel formula syntax and how to use that with the used POI API (
XSSFCell.setCellFormula (POI API Documentation)[
^]).