我需要在Java代码中将2个字节(2的补码)转换为int。我该怎么做?
toInt(byte hb, byte lb) { }
return ((int)hb << 8) | ((int)lb & 0xFF);
所有情况下的正确操作留给学生作为练习。