code: public static String capitalize(String str) {
          int strLen;
          if (str == null || (strLen = str.length()) == 0) {
              return str;
          }
          return new StringBuffer(strLen)
              .append(Character.toTitleCase(str.charAt(0)))
              .append(str.substring(1))
              .toString();
      }
docs: <p>Capitalizes a String changing the first letter to title case as
  per {@link Character#toTitleCase(char)}. No other letters are changed.</p>
  
  <p>For a word based algorithm, see {@link WordUtils#capitalize(String)}.
  A <code>null</code> input String returns <code>null</code>.</p>
  
  <pre>
  StringUtils.capitalize(null)  = null
  StringUtils.capitalize("")    = ""
  StringUtils.capitalize("cat") = "Cat"
  StringUtils.capitalize("cAt") = "CAt"
  </pre>
  
  @param str  the String to capitalize, may be null
  @return the capitalized String, <code>null</code> if null String input
  @see WordUtils#capitalize(String)
  @see #uncapitalize(String)
  @since 2.0