There is a subtle yet important difference between the StringBuffer and StringBuilder. StringBuffer is synchronized when it has to access/modify its contents, where as StringBuilder is not. A StringBuilder object is not safe to be shared across multiple threads.
It is much efficient to make use of StringBuilder when the StringBuilder object is not shared between multiple threads.
StringBuilder was introduced in JDK 1.5.