import java.util.Scanner; public class ReadInNumbersProgram { public static void main(String[] args) { int[] numbers = new int[100]; int count = 0; int enteredValue = 0; while (enteredValue != -1) { System.out.println("Enter number " + (count+1) + ": "); enteredValue = new Scanner(System.in).nextInt(); if (enteredValue != -1) numbers[count++] = enteredValue; } // ... do something interesting with the numbers ... } }