code: public static String capitalize(final String str) {
          int strLen;
          if (str == null || (strLen = str.length()) == 0) {
              return str;
          }
  
          final int firstCodepoint = str.codePointAt(0);
          final int newCodePoint = Character.toTitleCase(firstCodepoint);
          if (firstCodepoint == newCodePoint) {
              // already capitalized
              return str;
          }
  
          final int newCodePoints[] = new int[strLen]; // cannot be longer than the char array
          int outOffset = 0;
          newCodePoints[outOffset++] = newCodePoint; // copy the first codepoint
          for (int inOffset = Character.charCount(firstCodepoint); inOffset < strLen; ) {
              final int codepoint = str.codePointAt(inOffset);
              newCodePoints[outOffset++] = codepoint; // copy the remaining ones
              inOffset += Character.charCount(codepoint);
          }
          return new String(newCodePoints, 0, outOffset);
      }
docs: <p>Capitalizes a String changing the first character to title case as
  per {@link Character#toTitleCase(int)}. No other characters are changed.
  
  A {@code null} input String returns {@code null}.
  
  <pre>
  StringUtils.capitalize(null)  = null
  StringUtils.capitalize("")    = ""
  StringUtils.capitalize("cat") = "Cat"
  StringUtils.capitalize("cAt") = "CAt"
  StringUtils.capitalize("'cat'") = "'cat'"
  </pre>
  
  @param str the String to capitalize, may be null
  @return the capitalized String, {@code null} if null String input
  @since 2.0