How and with what method can we write integer int в byte[]
Limited to 3.5, DataInputStream / DataOutputStream - not suitable.
Estimated code:
// Записать этот инт int _sizeBlock = 10489; // В этот массив byte[] info = new byte[4]; How and with what method can we write integer int в byte[]
Limited to 3.5, DataInputStream / DataOutputStream - not suitable.
Estimated code:
// Записать этот инт int _sizeBlock = 10489; // В этот массив byte[] info = new byte[4]; int _sizeBlock = 10489; byte[] info = BitConverter.GetBytes(_sizeBlock); method documentation
It is possible that the computer uses the reverse order for storing bytes. You need to check the BitConverter.IsLittleEndian flag if it is set to true "flip" bytes in the array.
if (BitConverter.IsLittleEndian) Array.Reverse(info); Source: https://ru.stackoverflow.com/questions/639845/
All Articles
intnumber of0х12345678. What and where should be recorded? - VladD