Skip to content

Instantly share code, notes, and snippets.

@mahya8585
Created December 19, 2015 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahya8585/334a1ba40762028a1132 to your computer and use it in GitHub Desktop.
Save mahya8585/334a1ba40762028a1132 to your computer and use it in GitHub Desktop.
String連結に使ったソースコード
public class StrPlus {
public static void main(String[] args) {
int roopCount = 100000;
String word = "a";
usePlus(10000, word);
long start = System.currentTimeMillis();
usePlus(roopCount, word);
long end = System.currentTimeMillis();
System.out.println((end - start));
}
private static void usePlus(int roopCount, String word) {
String resultStr = "";
for (int count= 0; count < roopCount; count++) {
resultStr = resultStr + word;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment