Depends on whether you are programming a library or an application:
For libraries I have found Test Driven Development to work very well.
- FIRST add one or more tests that calls the library code you want to write, and compare the returned value to the desired result.
- THEN use your IDE to create the actual library code (Ctrl-1 in Eclipse is great). Just empty scaffolds.
- WHILE test fails DO revise library code UNTIL all tests pass (both your new ones and the previous ones)
In the above, write the simplest possible code that fullfill the tests (as they are your documentation of what the library does). Note that "simplest possible" can be quite complex, but does not have to be.
For applications I have usually found that performance bottlenecks is due to some library code not scaling properly. Use a profiler to identify these library calls, and add a test showing that the scaling is bad - probably by investigating the relative times measured by System.nanoTime() for a "small" and a "large" argument. Then revise again until all tests pass :)
It takes a bit more work up front, but it works well in the long run.
EDIT:
The only advice usually advocated is to be careful about the single overloaded operator in Java, namely string concatenation, where the naive "+=" approach does not scale well for large strings. There are several reasons for that - the primary one is that the JVM's constantly improve and what might be an issue in release 1.4 may be transparently improved to be of no importance in later revisions. A prime example is the HotSpot inlining of small methods, where method calls are simply optimized away. Also differnet JVM's have different weak spots. Only code around those when absolutely necessary.
All the usual tricks for circumventing various JVM limitations usually result in LESS READABLE CODE which goes against the "simplest code possible which does the job".
See "Evaluating Java for Game Development" for a discussion of the performance issues back in 2002. It is a very interesting read.
http://java.coe.psu.ac.th/FreeOnline/Evaluating%20Java%20for%20Game%20Development.pdf
For initial profiling the VisualVM with Java 6 u 10 or later, is quite usable.