public static int bytesToInt(byte[] bytes) {
int addr = bytes[3] & 0xFF;
addr |= ((bytes[2] << 8) & 0xFF00);
addr |= ((bytes[1] << 16) & 0xFF0000);
addr |= ((bytes[0] << 24) & 0xFF000000);
return addr;
}
public static int bytesToShort(byte[] bytes) {
int addr =( bytes[1] & 0xFF);
addr |= ((bytes[0] << 8) & 0xFF00);
return addr;
}