Write short value to byte array

image_pdfimage_print
   
 
//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[] WriteShort(short value)
        {
            byte[] result = new byte[2];
            result[0] = (byte)((value & 0xFF00) >> 8);
            result[1] = (byte)((value & 0x00FF));

            return result;
        }
   }
}

   
     


This entry was posted in Data Types. Bookmark the permalink.