title: Set maximum recursion depth in java
body: <p>I know this question has been answered already via numerous methods:<br></p>
  
  <ul>
  <li>Set maximum stack size (<code>-Xss20m</code>)</li>
  <li>Avoid the test what so ever - if you need a bigger recursion the problem is within the program.
  <Br></li>
  </ul>
  
  <p>Those methods are great, but I <strong>know</strong> there is a problem in my code, and I want to specifically limit (to a small number e.g. 5) the recursion depth, to test whether this is the problem.
  <br>Is there a method, like the <code>sys.setrecursionlimit</code> in python?</p>