private function checkTime (findNumber as Integer)
dim numberArr() as Integer = (6,8,10)
dim minNumber as integer = findNumber - numberArr(0)
dim minIndex as integer = 0
for i = 1 to numberArr.lenght
if findNumber - numberArr(i) >= 0 then
if minNumber >= 0 then
if findNumber - numberArr(i) < minNumber then
minNumber = findNumber - numberArr(i)
minIndex = numberArr(i)
end if
else
minNumber = findNumber - numberArr(i)
end if
end if
next
if minNumber < 0 then
minindex = 6
end if
return minIndex
end function