Java Solution using StringBuilder and Map
\nclass Solution {\n    public String entityParser(String text) {\n        HashMap<String, String> map = new HashMap<>();\n        map.put("&quot;","\\"");\n   
```\nclass Solution {\n    public String entityParser(String text) {\n        HashMap<String, String> map = new HashMap<>();\n        map.put("&quot;","\\"");\n        map.put("&apos;", "\'");\n        map.put("&amp;", "&");\n        map.put("&gt;", ">");\n        map.put("&lt;", "<");\n        map.put("&frasl;", "/");\n        \n        StringBuilder ans = new StringBuilder(), entity = new StringBuilder();\n        boolean and = false;\n        char ch[] = text.toCharArray();\n        for(int i = 0; i < ch.length; i++)\n        {\n            if(ch[i] == \'&\')\n            {\n                entity.append("&");\n                and = true;\n            }\n            else\n            {\n                if(ch[i] == \';\')\n                {\n                    entity.append(";");\n                    String s = entity.toString();\n                    if(map.containsKey(s))\n                        ans.append(map.get(s));\n                    else\n                        ans.append(s);\n                    \n                    entity.setLength(0);\n                    and = false;\n                }\n                else\n                {\n                    if(and)\n                        entity.append(ch[i]);\n                    else\n                        ans.append(ch[i]);\n                }\n            }\n        }\n        return ans.append(entity).toString();\n    }\n}\n```
[]