iTextSharp.text.pdf.ByteBuffer.ConvertToBytes C# (CSharp) Метод

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

private static ConvertToBytes ( int i ) : byte[]
i int
Результат byte[]
        private static byte[] ConvertToBytes(int i)
        {
            int size = (int)Math.Floor(Math.Log(i) / Math.Log(10));
            if (i % 100 != 0) {
                size += 2;
            }
            if (i % 10 != 0) {
                size++;
            }
            if (i < 100) {
                size++;
                if (i < 10) {
                    size++;
                }
            }
            size--;
            byte[] cache = new byte[size];
            size --;
            if (i < 100) {
                cache[0] = (byte)'0';
            }
            if (i % 10 != 0) {
                cache[size--] = bytes[i % 10];
            }
            if (i % 100 != 0) {
                cache[size--] = bytes[(i / 10) % 10];
                cache[size--] = (byte)'.';
            }
            size = (int)Math.Floor(Math.Log(i) / Math.Log(10)) - 1;
            int add = 0;
            while (add < size) {
                cache[add] = bytes[(i / (int)Math.Pow(10, size - add + 1)) % 10];
                add++;
            }
            return cache;
        }