code: protected void encodeOptionalParameters(Map<Integer, ISUPParameter> parameters, ByteArrayOutputStream bos)
              throws ParameterException {
  
          // NOTE: parameters MUST have as last endOfOptionalParametersParameter+1
          // param
          for (ISUPParameter p : parameters.values()) {
  
              if (p == null)
                  continue;
  
              byte[] b = ((AbstractISUPParameter) p).encode();
              // System.err.println("ENCODE O: "+p.getCode()+"---> "+Utils.toHex(b));
              // FIXME: this can be slow, maybe we shoudl remove that, and code
              // this explicitly?
              if (b.length > 255) {
                  throw new ParameterException("Parameter length is over 255: " + p);
              }
              if (!(p instanceof EndOfOptionalParametersImpl)) {
                  bos.write(p.getCode());
  
                  bos.write(b.length);
              }
              try {
                  bos.write(b);
              } catch (IOException e) {
                  throw new ParameterException("Failed to encode optional parameters.", e);
              }
          }
  
      }
docs: This method must be called ONLY in case there are optional params. This implies ISUPMessage.o_Parameters.size()>1 !!!
  
  @param parameters
  @param bos
  @throws ParameterException