code: public static void joinAndRepeat(StringBuilder sb, String str, String delimiter, int count) {
          if (count > 0) {
              sb.append(str);
              for (int i = 1; i < count; i++) {
                  sb.append(delimiter);
                  sb.append(str);
              }
          }
      }
docs: Repeats string of characters a defined number of times with a delimiter, and appends result to StringBuilder.
  
  <p>For example, <tt>joinAndRepeat(sb, "?", ",", 3)</tt> will append <tt>"?,?,?"</tt> to <tt>sb</tt>.
  
  @param sb StringBuilder to append result to
  @param str string of characters to be repeated.
  @param delimiter delimiter to insert between repeated items.
  @param count number of times to repeat, zero or a negative number produces no result