Oracle have a very good introductory tutorial on arrays.
Oracle Tutorial On Arrays
There are two ways using standard Arrays. In my first solution, I assume the values oct1 ... oct4 have been populated. However, after the following example is another solution that does not assume this and also takes input using Scanner.
int[] values ={oct1, oct2, oct3, oct4};
// Two examples:
// Using a 'for each' loop to display values
for(int value : values){
System.out.println(value);
}
// Using a standard 'for' loop to display values
for(int i; i < values.length; i++){
System.out.println(values[i]);
}
This solution uses an array and reads into it using the Scanner, but you must know how many values are to be read in advance or else you will need to learn lists.
int count = 4;
int[] values = new int[count];
Scanner scan = new Scanner(System.in);
// Using a standard for loop to read in values
for(int i; i < values.length; i++){
System.out.println("Enter a number");
values[i] = scan.nextInt();
}
// Using a standard 'for' loop. Assume this
// would come later in the program because
// you would otherwise read in and display
// the values in a single loop.
for(int i; i < values.length;i++){
System.out.println(values[i]);
}