Finally spotted the problem. The method definition should have read:
public static void spGetNextID( int iNextVal[], String vcIDName ) (not public static int spGetNextID...) and the line trying to return the integer at the end return iNextVal[0]; needed to be removed. Now it works. Regards