I need to convert 2 bytes (2\'s complement) into an int in Java code. how do I do it?
toInt(byte hb, byte lb) { }
return ((int)hb << 8) | ((int)lb & 0xFF);
Correct operation in all cases is left as an exercise for the student.