重复字符
String dupChar(char c, int count) {
StringBuffer sb = new StringBuffer();
for(int i=0;
i<count;
i++) sb.append(c);
return sb.toString();
}
或
char[] cc = new char[count];
Arrays.fill(cc, c);
return new String(cc);
反转:
String reverse(String s) {
return new StringBuffer(s).reverse().toString();
}