fix superheating and supercooling for java backend

@traiansf @yilongli please review
I guess this is to avoid non-deterministic behaviors.  OK.  I'll deal with the readme, if needed, later when I prepare cs422 for Spring.