java中一定有人遇見過byte取值為負數情況,比如0xc0對應的值-64,其實應該是192,這里就需要我們轉化處理
/**
* Description: 負數byte轉正int <BR>
*
* @author dsn
* @date 2018年12月29日 下午3:29:38
* @param b
* @return
* @version 1.0
*/
public static Integer byteToInteger(Byte b) {
return 0xff & b;
}
