AdvancedLauncher.Tools.Imaging.Utilities.GetInt16BinaryString C# (CSharp) Метод

GetInt16BinaryString() статический приватный Метод

Gets a 16 character binary string of the specified Int16 value.
This method was used during debugging and is left here just for fun.
static private GetInt16BinaryString ( Int16 n ) : string
n System.Int16 The value to get a binary string for.
Результат string
        internal static string GetInt16BinaryString(Int16 n)
        {
            char[] b = new char[16];
            int pos = 15;
            int i = 0;

            while (i < 16) {
                if ((n & (1 << i)) != 0) {
                    b[pos] = '1';
                } else {
                    b[pos] = '0';
                }
                pos--;
                i++;
            }
            return new string(b);
        }