Trace This Algorithm

Trace this algorithm to figure out its purpose.
It contains one error - find it and fix it.

public main()
{
    String[] names = {"aa","bb","cc","dd","ee"};
    change(names);
}

public void change(String[] names)
{
    for(int p=0; p <= names.length / 2; p = p+1)
    {  
        int x = (names.length-1-p);
        System.out.println(p + "  " +x);
        String a = names[p];
        String b = names[x];
        names[x] = a;
        names[p] = b;
    }
}

Solution

Purpose :  reverse the list of names to the opposite order

Error  :  Loop should say  ; p < names.length / 2 ;
            As it stands, it goes one step to far, and that will cause
             an error in a list with an even number of names (e.g. 6 names)