title: Point x value changes for no reason
body: <p>I have this method for looking for a free position inside a matrix. This is the output i get when I print the <code>matrix</code>. </p>
  
  <pre><code>1 0 0 0 0 0 0 
  1 1 1 0 0 0 0 
  1 1 1 0 0 0 0 
  0 1 0 0 0 0 0 
  0 0 0 0 0 0 0 
  0 0 0 0 0 0 0 
  0 0 0 0 0 0 0
  </code></pre>
  
  <p>I have a <code>currentPos</code> of <code>(0,0)</code>. The next free Position should be (0,1). when I call <code>NextFreePos()</code> it will change the <code>currentPos.x</code> value even though It shouldnt change. I only change the <code>x</code> if i get a true in the second for loop, but this always returns <code>false</code>, because I make <code>stop = true</code> inside the first for loop
  Here is the output I get when I run this method: </p>
  
  <pre><code>NEXT POS = (0;0)
  SAME X
  NEXT POS = (1;1) // I dont get why the x (first value) changed to 1
  
   public void nextFreePos(Point currentPos){
          // display the OLD POS (x,y) &lt;-- x = row and y = column
          System.out.println("OLD POS = ("+(currentPos.x)+";"+currentPos.y+")");       
          boolean stop = false;
          // check if there is a free Pos in current row, starting from current y
          for(int y = currentPos.y; y &lt; 7; y++){
              // check if Position is free and no free position has been found yet
              if(matrix[currentPos.x][y] == 0 &amp;&amp; stop == false){
                  stop = true;
                  System.out.println("SAME X");
                  currentPos.y = y;
              }
          }        
          currentPos.x++;        
          for(int x = currentPos.x; x &lt; 7; x++){
              for(int y = 0; y &lt; 7; y++){
                  // check if Position is free and no free position has been found yet
                  if(matrix[x][y] == 0 &amp;&amp; stop == false){
                      stop = true;
                      System.out.println("OTHER X");
                      // set the position to x and y
                      currentPos.x = x;
                      currentPos.y = y;  
                  }                
              }
          }  
          // display the NEXT POS (x,y)
          System.out.println("NEXT POS = ("+currentPos.x+";"+currentPos.y+")");       
      }
  </code></pre>