Would look something like this:
void switching(float[] array, int positionX, int positionY)
{
float temp = array[positionX];
array[positionX] = array[positionY];
array[positionY] = temp;
}
There you have a method that switches two elements in an array.
You'd call that from you other function like this:
...
switching(array, idxOfBiggest, idxOfSmallest);
...
where idxOfBiggest and idxOfSmallest are the indices of the biggest and the smallest array element.
Cheers!