public static long getExtractedLongValue (@Nonnull final BitSet aBS)
  {
    ValueEnforcer.notNull (aBS, "BitSet");

    final int nMax = aBS.length ();
    ValueEnforcer.isTrue (nMax <= CGlobal.BITS_PER_LONG,
                          () -> "Can extract only up to " + CGlobal.BITS_PER_LONG + " bits");

    long ret = 0;
    for (int i = nMax - 1; i >= 0; --i)
    {
      ret <<= 1;
      if (aBS.get (i))
        ret += CGlobal.BIT_SET;
    }
    return ret;
  }
public static long getExtractedLongValue ( @ Nonnull final BitSet aBS ) { ValueEnforcer . notNull ( aBS , "BitSet" ) ; final int nMax = aBS . length ( ) ; ValueEnforcer . isTrue ( nMax <= CGlobal . BITS_PER_LONG , ( ) -> "Can extract only up to " + CGlobal . BITS_PER_LONG + " bits" ) ; long ret = 0 ; for ( int i = nMax - 1 ; i >= 0 ; -- i ) { ret <<= 1 ; if ( aBS . get ( i ) ) ret += CGlobal . BIT_SET ; } return ret ; }
Extract the long representation of the passed bit set. To avoid loss of
data, the bit set may not have more than 64 bits.

@param aBS
The bit set to extract the value from. May not be <code>null</code>.
@return The extracted value. May be negative if the bit set has 64
elements, the highest order bit is set.