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

0

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.