title: Why is the JVM hanging up?
body: <p>I think this can be solved with setting traps/breakpoints - but I'm not quite sure on how to do that. This method is supposed to sort an array of objects (each object contains an int, which is a year), but I get nothing on the terminal, and a busy VM signal... What's going on? </p>
  
  <pre><code>public static movie2[] sortYear(movie2[] sort, int parameter)
  {
      int[] dest = new int[sort.length];
      if(parameter == 1)
      {
  
      for(int i = 0; i &lt; sort.length-1; i++)
      {
          int next = sort[i].getYear();
          int insertIndex = 0;
          int k = i; //Why do I need this?
          while( k &gt; 0 &amp;&amp; insertIndex == 0)
          {
              if(next &gt; dest[k-1])
              {
                  insertIndex = k;
              }
              else
              {
                  dest[insertIndex] = next;
              }
  
  
         }
         sort[i].setYear(dest[i]);
  
      }
  </code></pre>