title: How to use a scanner (BlueJ)
body: <p>I'm new to java and my task is to use a scanner to read in an array and an int in another method.This is what I have so far:</p>
  
  <pre><code>public static void main(String[] args){
  Scanner scanner = new Scanner(System.in);
  System.out.print("Enter n: ");
  int sz = scanner.nextInt();
  System.out.println("Enter locations of stones: ");
  int[] array = new int[sz];
  for (int i=0;i&lt;array.length;i++){
  array[i] = scanner.nextInt();
  }
  jump(array,sz);
  }
  </code></pre>
  
  <p>The method I want to read from starts like this:</p>
  
  <pre><code>public static void jump(int [] array, int amtStone){
  int x =0, moveOK =1, jumpedLoc =0, jumpedCount =1;
  //x: counter, moveOK: when 1, it is ok to continue. Otherwise, the jump is impossible.
  //jumpedLoc: to keep track of the current location of the rabbit
  //jumpCount: to count the amount of jumps
  while (x&lt;amtStone)
  {if(array[x+1]-array[x]&lt;=50){
  jumpedLoc = array[x+1];
  jumpedCount++;}
  }
  
  if (moveOK ==1)
  System.out.println(jumpedCount);
  else
  System.out.println("-1");
  
  }
  </code></pre>
  
  <p>What I'm doing is to calculate the smallest number of jumps it takes for a rabbit to reach the other side of the river. The ints in the array represents distances of stones from the starting point as one side of the river, and another int represents the number of stones. The longest distance the rabbit can jump is 50.</p>
  
  <p>for the input and output:</p>
  
  <p>Enter n: 7(Input,number of stones in the river)
  32 46 70 85 96 123 145(Input, distances between the stone and the starting point, the last number is the width of the river, i.e. the distance between the destination (the other side of the river)and the starting point)
  Output: 3(This is the smallest number of times a rabbit can jump) </p>
  
  <p>If it is not possible, the output is -1.</p>
  
  <p>When I run the main method, after I input the int and the array, there is no output and the program didn't continue. I'm not sure what to do next.</p>