code: public static String compose (String key, Object... args)
      {
          StringBuilder buf = new StringBuilder();
          buf.append(key);
          buf.append('|');
          for (int i = 0; i < args.length; i++) {
              if (i > 0) {
                  buf.append('|');
              }
              // escape the string while adding to the buffer
              String arg = (args[i] == null) ? "" : String.valueOf(args[i]);
              int alength = arg.length();
              for (int p = 0; p < alength; p++) {
                  char ch = arg.charAt(p);
                  if (ch == '|') {
                      buf.append("\\!");
                  } else if (ch == '\\') {
                      buf.append("\\\\");
                  } else {
                      buf.append(ch);
                  }
              }
          }
          return buf.toString();
      }
docs: Composes a message key with an array of arguments. The message can subsequently be
  decomposed and translated without prior knowledge of how many arguments were provided.