public class Test_21 {
public static void main(String[] args){
StringBuilder str = new StringBuilder("abcde");
int index =5;
System.out.println(LeftTurn(str,index));
}
public static String LeftTurn(StringBuilder sb,int index){
int strlen = sb.length();
if(sb !=null&&index=0&&index=strlen){
int firststart = 0;
int firstend = index-1;
int secondfirst = index;
int secondend = strlen-1;
ReverseString(sb,firststart,firstend);
ReverseString(sb,secondfirst, secondend);
ReverseString(sb,firststart,secondend);
return sb.toString();
}
return null;
}
public static void ReverseString(StringBuilder str,int begin, int end){
while(begin=end){
char temp = str.charAt(begin);
str.setCharAt(begin, str.charAt(end));
str.setCharAt(end, temp);
begin++;
end--;
}
System.out.println(str);
}}