```
public String reverseStr(String s, int k) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i = i + 2*k) {
for (int j = i+k-1; j >= i; j--) {
if (j < s.length()) {
sb.append(s.charAt(j));
}
}
for (int m = i+k; m < i + 2*k; m++) {
if (m < s.length()) {
sb.append(s.charAt(m));
}
}
}
return sb.toString();
}
```