The following code runs until it throws an IndexOutOfBoundExceptionstating h is -2147483648.
At the beginning h=0and it only gets incremented, never decremented. How could it become negative?
float[] powerArray = new float[8760];
int h = 0;
for (TShortIterator it = heightData.iterator(); it.hasNext();) {
short wspeed = it.next();
if (h < 8760) {
powerArray[h] = Math.min(wspeed, 4);
}
h++;
}