首先普及java byte short int 类型占用的字节位数
byte 内存占用 1字节 ,取值范围 -128~127;
short 内存占用 2字节,取值范围 -32768~32767;
int 内存占用4字节,取值范围-2e31~2e31-1;
long 内存占用8字节,取值范围-2e63~2e63-1;
float 内存占用 4字节
double 内存占用 8字节
所以带符号转化以整数为例
如果转化的16进制字符串为1字节则 取byteValue
Integer.valueOf("FF", 16).byteValue()
如果转化的16进制字符串为2字节则 取shortValue
Integer.valueOf("FFFF", 16).shortValue()
如果转化的16进制字符串为4字节则 取intValue(其他同理)