When using strings, the most important thing to remember is to use char arrays for all character processing in loops, instead of using the String or StringBuffer classes. Accessing an array element is much faster than using the charAt() method to access a character in a string. Also, remember that string constants ("...") are already string objects.
//DON'T
String s = new String("hello");
//DO
String s = "hello";
In addition:
class String
Do not use this class for mutable strings, character processing, or charAt() method inside a loop.
class StringBuffer
Use this class only when a string is mutable, accessed concurrently by multiple threads, and no character processing is performed. Do not use for immutable strings, character processing, or charAt(), setCharAt() methods inside a loop. The default string size is 16 characters. This class is automatically used by the compiler for string concatenation. Set the initial buffer size to the maximum string length, if it is known.
class StringTokenizer
This class is useful for simple parsing or scanning, but is very inefficient. It can be optimized by storing the string and delimiter in a character array instead of in String, or by storing the highest delimiter character to allow a quicker check. This will result in a 1.6x to 10x performance increase (2.4x is typical), depending on the delimiter list and target string.