That can be easily done by generating and HTML page using Java — StringBuilder needed — and then you can open the default application to load and render the HTML web page. That would be enough, if you just want to get the integer value and show it in a browser. However, if you wanted an application, web based, you might be looking for something Java powered, yet simple and easy to learn. Right? Then go for JSPs.
JSP are Java Server Pages, powered by Java EE. They are enough to build dynamic web applications using Java EE. Go through the following tutorials to get some help learning the frameworks.
JSP Tutorial[
^]
JavaServer Pages Technology[
^]