Package test; import Org. apache. commons. lang. stringutils; public class cutstring {// worst performing public string testplus () {string S = ""; for (INT I = 0; I <10000; I ++) {S = S + String. valueof (I) ;}return s ;}// Public String testconcat () {string S = ""; for (INT I = 0; I <10000; I ++) {S = S. concat (string. valueof (I);} return s;} // The performance is almost the same as teststringbuffer, which is better than public string testjoin () {string [] list = new string [10000]; for (INT I = 0; I <10000; I ++) {list [I] = string. valueof (I);} return stringutils. join (list, "");} Public String teststringbuffer () {stringbuffer sb = new stringbuffer (); long L1 = system. currenttimemillis (); For (INT I = 0; I <10000; I ++) {sb. append (string. valueof (I);} Long L2 = system. currenttimemillis (); system. out. println (l2-l1); return sb. tostring () ;}// method with the highest performance public void teststringbuilder () {stringbuilder sb = new stringbuilder (); For (INT I = 0; I <100000; I ++) {sb. append (string. valueof (I);} sb. tostring ();} public static void main (string [] ARGs) {system. out. println (New cutstring (). teststringbuffer ());}}