A good way to concatenate strings in a loop or when performing multiple concatenations, is to use the StringBuilder class:
1String s = "a"
2s+="b"; //this is slow
3
4StringBuilder sb = new StringBuilder();
5sb.Append("a");
6sb.Append("b");
2s+="b"; //this is slow
3
4StringBuilder sb = new StringBuilder();
5sb.Append("a");
6sb.Append("b");
From DevX