You are repeatedly calling nextInt()
, but not testing to see if there is a next int. Change this
for(int i=0; i<storage.length; i++) {
storage[i]=scanman.nextInt();
}
to this
for(int i=0; i<storage.length && scanman.hasNext(); i++) {
storage[i]=scanman.nextInt();
}
You'll need to determine if this is acceptable given your requirements, and if not, figure out why storage.length and the number of int-inputs are different than you expect.