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
  • 56,430
  • 9
  • 115
  • 140
Davita
  • 8,928
  • 14
  • 67
  • 119

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