Nomisco pointed out an error:

if (returnArray[value)> returnArray[value+1])