Question: I'm kinda of new in android. How can i send an email automatically without a contact chooser. 
I write a list of e-mails in edittext and an message and then i want to send to every email address. 
How can i do that?

Answer: 
You can search from the end **if the array is sorted correctly**, it's more simple to just find the first value no more than $number and return it.

```
$result = false;
foreach(array_reverse($arr) as $v)
{
  if($v <= $number)
  {
      $result = $v;
      break;
  }
}
if($result !== false)
  echo $result;

```
You can also use this function:

```
function get_less_value($arr, $number) {

    // Always sort the array first
    sort($arr);
    $i = 0;

    $biggest = 0;

    while ($number >= $arr[$i]) {
        $biggest = $arr[$i];
        $i++;
    }

    return $biggest;
}

echo get_less_value($arr, $number);

```

This is the naive solution and may work slow if your array would be very big.
Have a look at search algorithms. e.g: [Binary Search](https://en.wikipedia.org/wiki/Binary_search_algorithm)

Another PDF about the algorithms: <http://epaperpress.com/sortsearch/download/sortsearch.pdf>