Your test:
if (numberSet.length < 2) {
return 0;
}
should be done before you allocate an array of that length in the below statement:
int[] differenceArray = new int[numberSet.length-1];
else you are already creating an array of size -1
, when the numberSet.length = 0
. That is quite odd. So, move your if statement
as the first statement in your method.