docs: public static Header[] putHeader(final Header[] headers, short id, Header hdr, boolean replace_if_present) {
          int i=0;
          Header[] hdrs=headers;
          boolean resized=false;
          while(i < hdrs.length) {
              if(hdrs[i] == null) {
                  hdrs[i]=hdr;
                  return resized? hdrs: null;
              }
              short hdr_id=hdrs[i].getProtId();
              if(hdr_id == id) {
                  if(replace_if_present || hdrs[i] == null)
                      hdrs[i]=hdr;
                  return resized? hdrs : null;
              }
              i++;
              if(i >= hdrs.length) {
                  hdrs=resize(hdrs);
                  resized=true;
              }
          }
          throw new IllegalStateException("unable to add element " + id + ", index=" + i); // we should never come here
      }