public static void reverseString(char[] cs, int from, int to){ while(from < to){ char c = cs[from]; cs[from++] = cs[--to]; cs[to] = c; } }