I was looking into this, as the type necessary to hold this function seemed a little non-trivial. Here's one pretty verbose (but straightforward) solution that would be best extracted to a helper class (perhaps a org.apache.spark.util.collection.CollectionUtils class):
```
import java.util

import scala.Array
import scala.reflect._

object CollectionUtils {
  def makeBinarySearch[K <% Ordered[K] : ClassTag]: (Array[K], K) => Int = {
    classTag[K] match {
      case ClassTag.Float =>
        (l, x) => util.Arrays.binarySearch(l.asInstanceOf[Array[Float]], x.asInstanceOf[Float])
      case ClassTag.Double =>
        (l, x) => util.Arrays.binarySearch(l.asInstanceOf[Array[Double]], x.asInstanceOf[Double])
      case ClassTag.Byte =>
        (l, x) => util.Arrays.binarySearch(l.asInstanceOf[Array[Byte]], x.asInstanceOf[Byte])
      case ClassTag.Char =>
        (l, x) => util.Arrays.binarySearch(l.asInstanceOf[Array[Char]], x.asInstanceOf[Char])
      case ClassTag.Short =>
        (l, x) => util.Arrays.binarySearch(l.asInstanceOf[Array[Short]], x.asInstanceOf[Short])
      case ClassTag.Int =>
        (l, x) => util.Arrays.binarySearch(l.asInstanceOf[Array[Int]], x.asInstanceOf[Int])
      case ClassTag.Long =>
        (l, x) => util.Arrays.binarySearch(l.asInstanceOf[Array[Long]], x.asInstanceOf[Long])
      case _ =>
        (l, x) => util.Arrays.binarySearch(l.asInstanceOf[Array[AnyRef]], x.asInstanceOf[AnyRef])
    }
  }
}
```

Perhaps someone has a cleaner way to do this, but I couldn't think of anything short of macros.