Can anyone tell me why i am getting a java.lang.ArrayIndexOutOfBoundsException: 4
at Piglatinator.calculateVowelPositions(Piglatinator.java:53)
What this method is trying to do is calulate the vowel positions of a string entered by a user.

Code:
    public static int calculateVowelPositions(String str) throws ArrayIndexOutOfBoundsException 

    {
        str = str.toLowerCase(); 
        str = str.trim(); 
        int vowelPositions [] = new int [4]; 
        {
            vowelPositions [0] = str.indexOf('a');
            vowelPositions [1] = str.indexOf('e');
            vowelPositions [2] = str.indexOf('i');
            vowelPositions [3] = str.indexOf('o');
            vowelPositions [4] = str.indexOf('u');
        }   
        int position = 0; 
        for(int i = 0; i < vowelPositions.length + 1; i ++)
        {
            position = Math.min((int) vowelPositions[i -1], (int) vowelPositions [i]);
        }
        return position; 
    }