You are using an index of 4 and the exception is telling you that that index is out of range. That means that your array does not have that many elements.