BitsetsNET.BitsetContainer.Select C# (CSharp) Method

Select() public method

Return the jth value of the container.
public Select ( int j ) : ushort
j int Index of the value
return ushort
        public override ushort Select(int j)
        {
            int leftover = j;
            for (int k = 0; k < Bitmap.Length; ++k)
            {
                int w = Utility.LongBitCount(Bitmap[k]);
                if (w > leftover)
                {
                    return (ushort)(k * 64 + Utility.Select(Bitmap[k], leftover));
                }
                leftover -= w;
            }
            throw new ArgumentOutOfRangeException("Insufficient cardinality.");
        }