A non experienced java dev will use + or concat that creates a String each time (inmutable) so at the end you finish with a O(n^2). However using StringBuilder fits perfect for appends in loop giving a O(n)
http://kaioa.com/node/59