given array[index] find the nearest number in array