code: public static String asTitleCase(String text) {
          StringBuilder sb = new StringBuilder();
          boolean next = true;
  
          for (char c : text.toCharArray()) {
              if (Character.isSpaceChar(c)) {
                  next = true;
              } else if (next) {
                  c = Character.toTitleCase(c);
                  next = false;
              }
              sb.append(c);
          }
  
          return sb.toString();
      }
docs: Returns the text in title case