This is common in code that parses input, such as commands from the network or configuration data from the disk. Try to avoid new . Garbage collection is rarely a serious performance overhead.
Native methods are really fast .
This sounds silly, but I had heard that the overhead of invoking a native method was so high that it might be the case that small Java methods would be faster. In my test case, I implemented System.arraycopy in plain Java. I then compared this using arrays of different sizes against System.arraycopy . The native-method overhead may be high, but they're still fast compared to interpreting byte code. String operations are fast .