How do you reverse a string in place
Anonimo
private static String reverseString(String str) { char[] chars = str.toCharArray(); int s = 0; int e = chars.length - 1; while (s < e) { char tmp = chars[s]; chars[s] = chars[e]; chars[e] = tmp; s++; e--; } return new String(chars); }