Is your Java program slower than you think it could be? If so, the first thing you should do is gather and analyze a profile of its performance. There are several commercial profilers on the market, but many people are not aware that Sun's Java Development Kit ships with a profiling tool called 'hprof'.
Unfortunately, using hprof is a rather cryptic process and it is not well documented. In addition, it didn't work very well with JDK 1.2, especially if the HotSpot interpreter was enabled.
But now, with the HProf Ant task and JDK 1.3 or later, hprof is simple to use and it works reliably. Furthermore, there is a free profiler UI called prophIt, which can be used to visualize and explore hprof profiles.