code: public static int getExtractedIntValue (@Nonnull final BitSet aBS)
    {
      ValueEnforcer.notNull (aBS, "BitSet");
  
      final int nMax = aBS.length ();
      ValueEnforcer.isTrue (nMax <= CGlobal.BITS_PER_INT,
                            () -> "Can extract only up to " + CGlobal.BITS_PER_INT + " bits");
  
      int ret = 0;
      for (int i = nMax - 1; i >= 0; --i)
      {
        ret <<= 1;
        if (aBS.get (i))
          ret += CGlobal.BIT_SET;
      }
      return ret;
    }
docs: Extract the int representation of the passed bit set. To avoid loss of
  data, the bit set may not have more than 32 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 32
  elements, the highest order bit is set.