fix superheating and supercooling for java backend

@traiansf @yilongli please review