This web page contains links to sub-pages dealing with various Java related topics, some of which involve work at Bear Products International.
Market Trading and Finance Software
Lattice Pricing in Java Lattice pricing of stock options, written in Java. This includes a hack for pricing a "chooser options" (also know as an "as-you-like-it" option).
Elementary Algorithms in Java A collection of elementary algorithms in Java.
Ant Monte Carlo Elementary algorithms are used frequently when we write software, although usually we use libraries that implement them. The Ant Monte Carlo code is a synthetic problem. It does have some minor similarity to codes that are used to price options and other financial instruments. I encountered this problem as an interview question. The problem statement is:
Two ants start in opposite corners of a regular chessboard. Every 10 seconds, they move from the center of the square they're on to the center of an adjacent square. How long until they both land on the same square? How long until their paths cross (Ant A moving from square K to L and Ant B moving from square L to K)? What happens if we allow the ants to move diagonally? What happens if we restrict ants from moving to their immediately previous square? According to a follow up question: the ants are random antsIf you decide to use this code, read the class comment.
Miscellaneous Java Algorithms This web page publishes a variety of Java algorithms.
The javad program operates much like Sun's javap class file disassembler. That is, javad reads a class file and outputs a pseudo-Java declaration for the class that was the source for the class file. The javad program is published in source form, covered by the Bear Products International published source code copyright. The javad program is written in Java (as Sun would say, 100% pure Java, compile once, run anywhere - pass the Coolaid). The javad program was written as a tool to help understand the Java class file format. An understanding of the Java class file format is important for any program that reads class files (e.g., Java compilers, debuggers and Java virtual machines (JVMs). A compiler must be able to read the class file format because, unlike C and C++, Java does not use .h files to define external symbol information. This information is contained in the Java class files.
XML "pull parsers" provide a natural way to parse complex XML documents. These web pages provide examples of parsing XML that compare parsing using the SAX parser and the an XML "pull parser". XML is being used to represent information in a wide range of applications. This means that processing (parsing) XML is also needed in more and more cases. The three web pages below publish Java source code that shows how XML can be processed using the DOMParser, the SAXParser and the XmlPullParser.
Building and Processing XML in Java This web page publishes Java source code that demonstrates how to build XML Document objects. It also publishes code that shows how to parse, validate and process XML. An XML Document object is build from an arithmetic expression or assignment statement (e.g., x = 3 + 4 * 5). The resulting XML Document is then "serialized" to a String object. The String is then read by an XML parser, validated and converted to an XML DOM object. The DOM tree is traversed and the expression (or statement) is evaluated). The XML construction and evaluation objects are used to construct an interactive expression processor.
Parsing XML with SAX The DOMParser and the DOM object it builds are useful for processing complex XML documents. However, DOM may impractical for very large XML documents because of its memory use. Also, the construction and traversal of a DOM object has a computational cost. The SAXParser is an alternative to the DOMParser. This web page publishes example SAXParser code that processes prototype messages that might be used a Trade Engine, a software system that supports computer driven trading.
Processing XML with the XML Pull Parser As noted on the web page Parsing XML with SAX, the way SAX processes XML is "ass backward". The SAX parser calls code in the application what parses the XML document. The XML Pull Parser uses a standard parsing architecture and can be called by the parsing application.
Building an in-memory tree with the Xml Pull Parser This web page publishes a remarkably small object that builds an in-memory tree representation of an XML document using the XmlPullParser. A tree-to-XML serializer is also included.
An HTTP Client built with Apache Commons HttpClient classes A simple demonstration Java Servlet (I don't use Java servlets directly anymore. Rather I use Grails)
Wavelet Software in Java Wavelets might be thought of as Fourier Transforms for the twentieth and twenty-first centuries. Wavelet techniques have been applied in a wide variety of areas including signal processing, time series analysis and data compression. See also my web page on Wavelets and Signal Processing.
Miscellaneous Java Topics Web pages discussing miscellaneous Java related topics.
Essays on Java
Build It Faster in Java: a story of software reuse Many people have commented that writing software in Java allows them to be much more productive than in C++. Why is this? Is software development in Java faster because "Java changes everything"? According to the adds Sun Microsystems once ran in magazines like The New Yorker and Vanity Fair (before the dot-com bubble burst), Java provides an amazing new paradigm, used by the Uber-Programmer, which drastically cuts the cost of software development. Is this true? To understand the answer to these questions we must examine Java, its runtime environment and its class library and leave the hype behind.
Is Java a good first programming language? I gotten a few emails from people asking if Java is a good choice for a first programming language. For most people younger than high school age, Java is a poor choice for a first programming language. This web page briefly discusses this issue and suggests alternatives.
In the relatively early days of Java I started work on a Java to native compiler. The Compiling Java web pages discuss the motivation for compiling Java into native code and some notes on architecture. This material was written before the Java Just-in-Time compiler became quite advanced and able to deliver C++ levels of performance in some cases. I concluded that there was no market for a Java to native compiler so I did not finish it. For some applications, Java is constrained by the fact that it is an interpreted language, which resolves symbol references at run time. This makes Java considerably slower than compiled C++ and it limits Java's ability to access system resources to the Java Native Interface. As a result, Java as it currently exists, will not be used in computationally intensive applications like VLSI design software or simulation software.
Notes on Resin and Servlets I have not used Resin for sometime. My experience has been that Apache Tomcat is preferable to Resin and I now use Tomcat when I need a Java application container. Notes on installing the Resin HTTP and Java server. Resin is an easy to install HTTP and Java server (e.g., it can run Java servlets). Resin is, itself, written in Java.
Java is the capital island in the Indonesian archipelago. Back in the days of the Dutch East India company it was a major source of coffee beans. In modern times the island of Java has been eclipsed as a coffee producer by South America and other countries in Asia. As it turns out, Java is also a street in Sunnyvale, California (near Caribbean Dr.). In the computer realm Java is now most famous for being a programming language, designed by Gosling, Steel and Joy at Sun Microsystems. When Java is used in this context, Java is a trademark of Sun Microsystems.
Ian Kaplan, February 12, 2000
Last revised: April 19, 2015
back to Contents web page