0

I have a byte array, received from java application via network. I need to parse this array correctly. The format is as follow:

int - first for bytes
int - next for bytes
string - rest of data.

Take a look at this screenshot.
As you can see, the first four bytes is 0, 0, 0, 1. The actual integer value should be 1, but when I read it through BinaryReader.ReadInt32, I receive 16777216. I doubt this has something to do with byte endianness (but could be wrong), but I don't know how to fix it.

Any help would be appreciated.

Thanks

digEmAll
  • 54,872
  • 9
  • 113
  • 136
Davita
  • 8,610
  • 12
  • 62
  • 114

1 Answers1

2

Yes, that's an endian issue. This question has examples of how to reverse the byte-order of integer types

Community
  • 1
  • 1