ColorBuffer center(String str, int len) {
    if (str == null) {
      str = "";
    }
    StringBuilder buf = new StringBuilder(str);
    while (buf.length() < len) {
      buf.append(" ");
      if (buf.length() < len) {
        buf.insert(0, " ");
      }
    }
    return append(buf.toString());
  }
Pad the specified String with spaces to the indicated length

@param str
         the String to pad
@param len
         the length we want the return String to be
@return the passed in String with spaces appended until the
        length matches the specified length.
beeline/src/java/org/apache/hive/beeline/ColorBuffer.java