code: public static int decodeSequence(ByteBuffer buf) {
          DerId id = DerId.decode(buf);
          if (!id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.CONSTRUCTED, ASN1_SEQUENCE_TAG_NUM)) {
              throw new IllegalArgumentException("Expected SEQUENCE identifier, received " + id);
          }
          int len = DerUtils.decodeLength(buf);
          if (buf.remaining() < len) {
              throw new IllegalArgumentException("Insufficient content for SEQUENCE");
          }
          return len;
      }
docs: Decode an ASN.1 SEQUENCE by reading the identifier and length octets. The remaining data in the buffer is the SEQUENCE.
  
  @param buf
  the DER-encoded SEQUENCE
  @return the length of the SEQUENCE