A quick and dirty example below. You can do this using differently.
public class html2text {
public static void main(String args[]){
String text="<html><head><title>test</title></head>\n<body><h1>Heading</h1></body></html>";
int first=0;
int last=0;
while(true){
first=text.indexOf("<");
last=text.indexOf(">");
if(first>-1 && last >-1){
text=text.substring(0, first)+text.substring(last+1, text.length());
}else{
break;
}
}
System.out.println(text);
}
}