code: public static int sizeOfBitString(BitSet value, int nbits) {
          return DerUtils.sizeOf(ASN1_BIT_STRING_TAG_NUM, (int) Math.ceil(nbits / 8.0d) + 1); // +1 for padding
      }
docs: Size of an ASN.1 BIT STRING.
  
  @param value
  the BIT STRING value
  @param nbits
  the number of bits in the bit string
  @return the size of the encoded data