Why i am getting index out of bound exception here

@Narasimha,
https://ide.codingblocks.com/s/224834 corrected code

add a return statement to your base case. And, add an โ€œelseโ€ after the if(str.charAt(si)==โ€˜xโ€™) block, that way you will avoid all the unnecessary calls .