Java dynamic programs