Java - Write code to unquote Html Special Chars

Requirements

Write code to unquote Html Special Chars

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String html = "boo<>k2s.com";
        System.out.println(unquoteHtmlSpecialChars(html));
    }//from  w  w  w  .  j a v  a 2 s.c  o  m

    public static String unquoteHtmlSpecialChars(String html) {
        if (html == null)
            return null;
        String[] specialChars = { "&", "\"", "'", "<", ">", " " };
        String[] quoteChars = { "&amp;", "&quot;", "&apos;", "&lt;",
                "&gt;", "&nbsp;" };
        for (int i = 0; i < specialChars.length; i++) {
            html = html.replace(quoteChars[i], specialChars[i]);
        }
        return html;
    }
}