title: Java Looping Arrays
body: <p>How do I make this loop properly? it right now So it loops but it does not  loop properly. It does this<br><br>
  Here are the numbers:</p>
  
  <pre><code>15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 [1]
  </code></pre>
  
  <p>How many positions do you want to shift?: 2</p>
  
  <pre><code>2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 [3]
  </code></pre>
  
  <p>How many positions do you want to shift?: 4</p>
  
  <p>the [] are where its suppose to ask me for my input instead of me just putting in a input<Br>
  its suppose to run like this: <br><BR></p>
  
  <p>re are the numbers:</p>
  
  <pre><code>15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
  </code></pre>
  
  <p>How many positions do you want to shift?: 1</p>
  
  <pre><code>2 1 15 14 13 12 11 10 9 8 7 6 5 4 3
  </code></pre>
  
  <p>How many positions do you want to shift?: 4</p>
  
  <pre><code>System.out.println("Here are the numbers:");
  for (i=0; i&lt;numberArray.length; i++) {
      System.out.print(numberArray[i] + " ");
  }
  
  while (x != input.nextInt()){
  
      System.out.printf("How many positions do you want to shift?: ");
      int shiftTimes=input.nextInt();
      for( i = 0; i &lt; shiftTimes; ++i) 
  
          shift.Shifter(numberArray);
  
          for(j = 0; j &lt; numberArray.length; j++)
              System.out.printf(numberArray[j]+" ");
          }
      }
  }    
  </code></pre>
  
  <p>Also How Do I make it exit the program when I enter in a invalid number and how do I get get it to read a negative value and get it to shift left</p>
  
  <p>Edit: heres my shifter code</p>
  
  <pre><code>public static void Shifter(int[] list)
  {
  int i;  
  
  if (list.length &lt; 2) return;
  
  int last = list[list.length - 1];
  
  for(i = list.length - 1; i &gt; 0; i--) {
  list[i] = list[i - 1];
  }
  list[0] = last;
  }
  </code></pre>