Thats because bytes are signed. (byte)0xF0
is actually the same as (byte)-16
.
To convert as unsigned quantity you can mask the lower 8 bits:
int byte1 = byteArr[0] & 0xff;
int byte2 = byteArr[1] & 0xff;
int byte3 = byteArr[2] & 0xff;
String pgnString = String.valueOf(byte1 * 0x10000 + byte2 * 0x100 + byte3);