|
@@ -1,4 +1,5 @@
|
1
|
1
|
|
|
2
|
+import java.lang.StringBuilder;
|
2
|
3
|
|
3
|
4
|
/**
|
4
|
5
|
* Created by dan on 6/14/17.
|
|
@@ -87,11 +88,11 @@ public class StringUtilities {
|
87
|
88
|
*/
|
88
|
89
|
public String reverse(String stringToReverse){
|
89
|
90
|
char[] chars = stringToReverse.toCharArray();
|
90
|
|
- String newString = "";
|
|
91
|
+ StringBuilder str = new StringBuilder();
|
91
|
92
|
for(int i = chars.length - 1; i >= 0 ; i--){
|
92
|
|
- newString = newString + Character.toString(chars[i]);
|
|
93
|
+ str.append(Character.toString(chars[i]));
|
93
|
94
|
}
|
94
|
|
- return newString;
|
|
95
|
+ return str.toString();
|
95
|
96
|
}
|
96
|
97
|
|
97
|
98
|
/**
|