Java - Write code to strip Html Special Chars

Requirements

Write code to strip Html Special Chars

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String html = "<b>ook2s.com";
        System.out.println(stripHtmlSpecialChars(html));
    }/*from  ww w.j  a  v  a  2  s  . c  om*/

    public static String stripHtmlSpecialChars(String html) {
        if (html == null)
            return null;
        html = html.replaceAll("</?[^>]+>", "");
        html = html.replace("&nbsp;", " ");

        return html;
    }
}