Search insert position
In Java, the most efficient implementation of this will likely be 

public int searchInsert(int[] numbers, int target) {
    int index = Arrays.binarySearch(numbers, target);

    if (index &lt; 0) {
        index = -index - 1;
    }

    return index;
}


With that said, the place where I'd look first are your special cases.  Under what circumstances would midIndex be less than 0 or more than numbers.length - 1?  Never (if it was, numbers[midIndex] would throw an out of bounds exception).  And when will it be equal?  When we've found the edge, when endIndex will be less than startIndex.  

So simplify 

    while (startIndex &lt; endIndex) {
        midIndex = (endIndex - startIndex) / 2 + startIndex;
        if (numbers[midIndex] == target) {
            return midIndex;
        }

        if (numbers[midIndex] &lt; target) {
            startIndex = midIndex + 1;
        }
        else {
            endIndex = midIndex - 1;
        }
    }

    return startIndex;


This will do one extra assignment and outer loop comparison but save two comparisons on every iteration.  Since the assignment only involves registers and math, it should be quick (possibly quicker than the comparisons, which have to load the registers from cache if not memory).  

Without the extra checks, the code will update either startIndex or endIndex and make the same return.  Because startIndex will equal either midIndex or midIndex + 1, the same as was returned in the original code.