code: public void write_bitstr(final byte[] bin, final int pad_bits) {
          if (pad_bits == 0) {
              write_binary(bin);
              return;
          }
          write1(OtpExternal.bitBinTag);
          write4BE(bin.length);
          write1(8 - pad_bits);
          writeN(bin);
      }
docs: Write an array of bytes to the stream as an Erlang bitstr.
  
  @param bin
  the array of bytes to write.
  @param pad_bits
  the number of zero pad bits at the low end of the last byte