title: How to move positions within an array in Java?
body: <p><strong>A program that simply moves array elements.</strong></p>
  
  <p>Two variables: <code>userInputVariable</code> and <code>blankSpaceVariable</code>.</p>
  
  <p>I have a 2D array named table. Defined as <code>table[userInputVariable + 1][6]</code></p>
  
  <p>I am printing out this array in a table format, and the far left column is numbered by whatever number the user entered at the beginning of the program.</p>
  
  <p>I then ask the user where they would like to enter a blank space within the array. This blank space acts like a divider for all the other information in the array.</p>
  
  <p>For example, if the user enters 10 at the start for the <code>userInputVariable</code>, and then enters 5 for the blank space. Once printed, the numbers should go like this:</p>
  
  <p>1, 2, 3, 4, --, 5, 6, 7, 8, 9, 10.</p>
  
  <p>My plan has been to create a for loop and try to move all the numbers in the array back a position starting from the blank space variable.</p>
  
  <p>What I currently have, but does not work:</p>
  
  <pre><code>for (int i = blankSpaceVariable; i &lt; table.length - 1; i++) 
  {
  table[i] = table[i + 1];
  }
  table[blankSpaceVariable] = "--";
  </code></pre>
  
  <p>With my current code, the numbers go like this:</p>
  
  <p>1, 2, 3, 4, 6, 7, 8, 9, 10</p>
  
  <p>Tried completing this a few different ways also, but the other info within my 2D array didn't move with the numbers. So I thought that this approach can hopefully move all the info within my 2D array down, and make way for a blank section.</p>
  
  <p>All help is greatly appreciated!</p>