Revised find so that it runs in constant time for both i equal to zero and size minus one. Also auto formatted the code.