File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -14,16 +14,16 @@ public static void main(String[] args) {
1414 }
1515
1616 public static void shortConcatenation () {
17- String out = "" ;
18- final long start = System .nanoTime ();
19- for (int j = 0 ; j < 35000 ; j ++) {
20- out += "y" ;
17+ String out = "" ;
18+ final long start = System .nanoTime ();
19+ for (int j = 0 ; j < 35000 ; j ++) {
20+ out += "y" ;
21+ }
22+ final long end = System .nanoTime ();
23+ System .out .println ("Time is: " + (end - start ) / 1000000 + " ms" );
24+ System .out .println ("Number of chars in string: " + out .length ());
25+ System .out .println ("Number of iterations: " + out .length ());
2126 }
22- final long end = System .nanoTime ();
23- System .out .println ("Time is: " + (end - start ) / 1000000 + " ms" );
24- System .out .println ("Number of chars in string: " + out .length ());
25- System .out .println ("Number of iterations: " + out .length ());
26- }
2727
2828 public static void longConcatenation () {
2929 String out = "" ;
You can’t perform that action at this time.
0 commit comments