翻转字符串,即输入:abcd,输出:dcba,
public static String reerseStringByStringBuffer(String str){
StringBuffer result = new StringBuffer();
for(int i=0;i<str.length();i++){
result.append(str.substring(str.length()-1-i, str.length()-i));
}
return result.toString();
}
文章来源:
http://huxiaofei590.blog.163.com/blog/static/3259612200791091630470