code: public static String concatenate(String[] values, String sepStr) {
          assert values != null;
          assert sepStr != null;
  
          // Watch for the empty case first.
          if (values.length == 0) {
              return "";
          }
  
          // This handles any size >= 1.
          StringBuilder buffer = new StringBuilder();
          boolean bFirst = true;
          for (String value : values) {
              if (bFirst) {
                  bFirst = false;
              } else {
                  buffer.append(sepStr);
              }
              buffer.append(value);
          }
          return buffer.toString();
      }
docs: Join together the Strings in the given array into a single string with values
  separated by the given string. An empty array returns an empty String. An array
  with a single value returns the same value. Otherwise, each value is concatenated
  in order with the separation string added between values (but not before the first
  value or after the last value).
  
  @param values    An array of Strings.
  @param sepStr    Separator string to use between values.
  @return          The Strings concatenated together with the given separate string
  between values.