public class FanShou {
public static void main(String[] args) {
String str = “ABCDEFG”;
String result = new FanShou().process(str, 3);
System.out.println(result);
}
public String process(String str, int m){
char[] cs = str.toCharArray();
turnHand(cs,0,m-1);//前半部分转置
turnHand(cs,m,cs.length-1);//后半部分转置
turnHand(cs,0,cs.length-1);//所有字符串转置
return new String(cs);
}
public void turnHand(char[] cs,int i,int j){
int length = j-i+1;
for(int t=0;t
喵呜刷题:让学习像火箭一样快速,快来微信扫码,体验免费刷题服务,开启你的学习加速器!