September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,9 +1,10 @@
|
|||
public static String repeat(String str, int times){
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for(int i = 0;i < times;i++) ret.append(str);
|
||||
return ret.toString();
|
||||
public static String repeat(String str, int times) {
|
||||
StringBuilder sb = new StringBuilder(str.length() * times);
|
||||
for (int i = 0; i < times; i++)
|
||||
sb.append(str);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
System.out.println(repeat("ha", 5));
|
||||
public static void main(String[] args) {
|
||||
System.out.println(repeat("ha", 5));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
public static String repeat(String str, int times){
|
||||
public static String repeat(String str, int times) {
|
||||
return new String(new char[times]).replace("\0", str);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue