protected int BinarySearchForNearest(int val, int begin, int end)
        {
            int mid    = (begin + end) / 2;
            int midval = m_array.Get(mid);

            if (mid == end)
            {
                return(midval >= val ? mid : -1);
            }

            if (midval < val)
            {
                // Find number equal or greater than the target.
                if (m_array.Get(mid + 1) >= val)
                {
                    return(mid + 1);
                }

                return(BinarySearchForNearest(val, mid + 1, end));
            }
            else
            {
                // Find number equal or greater than the target.
                if (midval == val)
                {
                    return(mid);
                }

                return(BinarySearchForNearest(val, begin, mid));
            }
        }
        public static int ConvertToBytes(Int32Array instance, byte[] @out, int offset)
        {
            int numInt = 0;

            Conversion.Int32ToByteArray(instance.m_len, @out, offset);
            offset += Conversion.BYTES_PER_INT32;
            numInt++;

            Conversion.Int32ToByteArray(instance.m_count, @out, offset);
            offset += Conversion.BYTES_PER_INT32;
            numInt++;

            Conversion.Int32ToByteArray(instance.m_growth, @out, offset);
            offset += Conversion.BYTES_PER_INT32;
            numInt++;

            for (int i = 0; i < instance.m_count; i++)
            {
                int data = instance.Get(i);
                Conversion.Int32ToByteArray(data, @out, offset);
                offset += Conversion.BYTES_PER_INT32;
            }
            numInt += instance.m_count;
            return(numInt);
        }