Created
December 19, 2015 04:01
-
-
Save mahya8585/334a1ba40762028a1132 to your computer and use it in GitHub Desktop.
String連結に使ったソースコード
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
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