大华的一道面试题:
package cn.zstu.mytest;
import org.junit.Test;
/**
* 字符串的反转
* 例 s="hello",return "olleh"
* @author faz
*
*/
public class StringReverse {
public String stringRever(String s) {
StringBuilder sb = new StringBuilder(s);
String newString = sb.reverse().toString();
return newString;
}
@Test
public void main() {
System.out.println(stringRever("hello"));
}
}