stringOfChar static method

String stringOfChar(
  1. String ch,
  2. int len
)

Creates a string of a given length containing the given character

@param ch the character to be repeated @param len the len of the desired string @return the string

Implementation

static String stringOfChar(String ch, int len) {
  StringBuffer buf = new StringBuffer();
  for (int i = 0; i < len; i++) {
    buf.write(ch);
  }
  return buf.toString();
}