import java.util.*; public class StringAppendTest { public static void main(String[] args) throws Exception { int n = Integer.parseInt(args[0]); String s = "a"; for(int i = 0; i < n; i++) s += "a"; System.out.println("length(s) = " + s.length()); } } /* What's wrong StringAppendTest 10000 -> 0.374 seconds StringAppendTest 100000 -> 17.860 seconds StringAppendTest 1000000 -> seconds */