Will someone pliz look through this code, I need suggestions...

Java Code:

//Please read through the file and help whenever yo can.Thanks in Advance!
/*
****************MY PROBLEMIN THE CODE BELOW********************************************
* 1) The ArrayIndexOutOfBoundsException is thrown no matter the number of array values splited from the input.
* 2) How can I include the invalid unitCode in the catch block statement so that the user knows exactly which units
* are/is invalid? Something like :
* try{.....} //try block
* catch (IlegalArgumentEXception e){
* System.out.printf("%-5s"+" is an invalid unit.",someRefToTheInvalidUnit)
* id place unitCode[index] here ^^^^^^^^^ but that would be stupid!
* }
**********************MY PLEA
*I'll be glad if you have suggestions on how I can make registerUnits( ) a better method.
******************************************************************************************************
*/
//the method starts here
public void registerUnits(){
final int MAX_UNITS = 8;
String units;
//sample unitcodes: SPH100 SPH200 SPH202 SCH100 SMA102 SMA203
//which are defined as enums in an enum file UniversityUnits.java included in this project
System.out.println("Enter the codes of units to register separated with a hyphen(-):");
units = input.next().toUpperCase();
try {
String unitCode [] = new String [MAX_UNITS];
unitCode = units.split("-");
for (int index = 0; index < MAX_UNITS;index++){
UniversityUnits.valueOf(unitCode[index]);
System.out.printf("%-5s"+" accepted!\n",unitCode[index]);
}
}
catch(IllegalArgumentException e) {
System.out.println("Wrong unit code!");
}
catch(ArrayIndexOutOfBoundsException iobe) {
System.out.println("Up to 8 units only per semester!!");
// I'd appreciate this >> System.out.printf("%-5s"+" is an invalid unit.",someRefToTheInvalidUnit);
//Any suggestions regarding this ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ are impatiently awaited.
}
*/
***********************EXPLANATION****************************
*registerUnits is a method that gets input from the user in the e.g SPH100-SCH100-SCH100-SPH200.
* It spilts( with (-) as the delimiter) the input into arrays whose values are
*the strings SPH100 SPH200 SCH200 SCH100 e.t.c .
*It verifies if the units are valid university units by calling the values for an enum class
*i.e UniversityUnits.valueOf(String toBeChecked)
*and checking the values of each array against the called values.An illegalArgumentException is thrown
* if the array value[s] does not match the values returned by UniversityUnits.valueOf(unitCode[index]).
*/

Thanks,
I did that and it prints the input exactly as I typed.
My real problem is that the ArrayIndexOutOfBoundsEXception is thrown even when the array index are not out of bounds.So I get the message
"Upto 8 units per semester only!"
at the end of the execution.

I'm surprised and obviously confused by this output:
//program starts executing:
Enter the codes of units you wish to register separated with a hyphen(-).e.g SPH100-
SMA102-SCH100-...: |
sph100-sch100-sch200 //my input
[null, null, null, null, null, null, null, null]
// ^^^^^^^^^^^^^^^^^^^output of System.out.println(Arrays.toString(unitCode));
You entered a non integer value.Choose between 1-4!
//^^^^^^^^^^^^^^^^^^^^^^^array index out of bound exception cought by a
//catch block in my main.java and not by the catch block in registerUnits( ) as required