描述:字符串反转,即把字符串"abcd"变为"dcba"
public static void main(String[] args) {
String str = "abc";
System.out.println(reverse6(str));
}
public static String reverse6(String str) {
int len = str.length();
if (len <= 1) {
return str;
}
String left = str.substring(0, len / 2);
String right = str.substring(len / 2, len);
return reverse6(right) + reverse6(left);
}