code: public static void html(StringBuilder sb, String html) {
          for (int i = 0; i < html.length(); i++) {
              char c = html.charAt(i);
              switch (c) {
              case '&':
                  sb.append("&amp;");
                  break;
              case '"':
                  sb.append("&quot;");
                  break;
              case '\'':
                  sb.append("&apos;");
                  break;
              case '<':
                  sb.append("&lt;");
                  break;
              case '>':
                  sb.append("&gt;");
                  break;
              default:
                  sb.append(c);
              }
          }
      }
docs: Escapes HTML appending to StringBuilder.
  
  @param sb StringBuilder to append to
  @param html input