code: public static String resolveEntity(String entity) {
          if (entity.length() > 1 && entity.charAt(0) == '#') {
              if (entity.charAt(1) == 'x') {
                  return String.valueOf((char) Integer.parseInt(entity.substring(2), 16));
              } else {
                  return String.valueOf((char) Integer.parseInt(entity.substring(1)));
              }
          } else if (entity.equals("apos")) {
              return "'";
          } else if (entity.equals("quot")) {
              return "\"";
          } else if (entity.equals("gt")) {
              return ">";
          } else if (entity.equals("lt")) {
              return "<";
          } else if (entity.equals("amp")) {
              return "&";
          } else {
              return entity;
          }
      }
docs: Simple HTML/XML entity resolving: Only supports unicode enitities and a very limited number text represented
  entities (apos, quot, gt, lt, and amp). There are many more: http://www.w3.org/TR/REC-html40/sgml/dtd.html
  
  @param entity The entity name without & and ; (null throws NPE)
  @return Resolved entity or the entity itself if it could not be resolved.