/*
- 2,写一个字符串倒序的算法,请勿使用系统api
- */
public class FaceTow {
private static String getResult(String origin){
int length=origin.length();
char[] value=origin.toCharArray();
char temp;
for(int i=0;i<length/2;i++){
temp=value[i];
value[i]=value[length-i-1];
value[length-i-1]=temp;
}
return new String(value);
}
public static void main(String[] args) {
System.out.println(getResult("abcdefghizklmnopqrstuvwxyz"));
}
}
网友评论