Mega Code Archive

 
Categories / C# / Data Types
 

Write int 32 to byte array

//http://walkmen.codeplex.com/license // License:  GNU General Public License version 2 (GPLv2)   using System; using System.Collections.Generic; using System.Text; namespace Walkmen.Util {     public sealed class NumericUtils     {         private NumericUtils()         {         }         public static byte[] WriteInt32(int value)         {             byte[] result = new byte[4];             result[0] = (byte)((value & 0xFF000000) >> 24);             result[1] = (byte)((value & 0x00FF0000) >> 16);             result[2] = (byte)((value & 0x0000FF00) >> 8);             result[3] = (byte)((value & 0x000000FF));             return result;         }    } }