-
-
Save conanak99/2465130f5733ae355c26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int total = 50000; | |
String s = ""; | |
for (int i = 0; i < total; i++) { s += String.valueOf(i); } | |
// 4828ms | |
StringBuilder sb = new StringBuilder(); | |
for (int i = 0; i < total; i++) { sb.append(String.valueOf(i)); } | |
// 4ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment