Why doesn't it work? It works, your algorithm is just wrong.
This should work:


private void convertButton2ActionPerformed(java.awt.event.ActionEvent evt) {
int tempCels2;
tempCels2 =...