Byte representation of integer
C#
2
Posts
2
Posters
0
Views
1
Watching
-
Anybody can tell me how do I get the byte representation of an integer? E.g. int iValue=500, then the byte representation is 00 00 01 F4. Thanks.
int iValue = 500; byte byte0 = iValue; // byte0 is 0xF4 byte byte1 = iValue >> 8; // byte1 is 0x01 byte byte2 = iValue >> 16; // byte2 is 0x00 byte byte3 = iValue >> 24; // byte3 is 0x00