title: How detect infinite loop in Java?
body: <p>I run a Java program, and it doesn't ends in a long time. I guess it may be a infinite loop in the code, but I can't see the code(can't modify it).</p>
  
  <p>How to judge it's in a infinite loop or not?</p>
  
  <hr>
  
  <p>It's an interview question and my answer is judge PC(program counter) is in loop or not. But the interviewer give me the hint <code>use stack and heap of that program</code>...</p>