code: public static String caseCanonicalize(String s) {
      for (int i = 0, n = s.length(); i < n; ++i) {
        char ch = s.charAt(i);
        char cu = caseCanonicalize(ch);
        if (cu != ch) {
          StringBuilder sb = new StringBuilder(s);
          sb.setCharAt(i, cu);
          while (++i < n) {
            sb.setCharAt(i, caseCanonicalize(s.charAt(i)));
          }
          return sb.toString();
        }
      }
      return s;
    }
docs: Returns the case canonical version of the given string.