### Question:
ListNumbers { public static int binarySearchValueOrLower(ListNumber values, double value) { if (value <= values.getDouble(0)) { return 0; } if (value >= values.getDouble(values.size() -1)) { return values.size() - 1; } int index = binarySearch(0, values.size() - 1, values, value); while (index != 0 && value == values.getDouble(index - 1)) { index--; } return index; }  static SortedListView sortedView(ListNumber values); static SortedListView sortedView(ListNumber values, ListInt indexes); static int binarySearchValueOrLower(ListNumber values, double value); static int binarySearchValueOrHigher(ListNumber values, double value); static ListNumber linearListFromRange(final double minValue, final double maxValue, final int size); static ListNumber linearList(final double initialValue, final double increment, final int size); static boolean isLinear(ListNumber listNumber); static ListNumber toListNumber(Object primitiveArray); static ListNumber listView(ListNumber list, ListInt indexes);  }### Answer:
@Test public void binarySearchValueOrLower1() { ListNumber values = new ArrayDouble(1,2,3,3,4,5,5,6,7,8,10); assertThat(ListNumbers.binarySearchValueOrLower(values, 1), equalTo(0)); assertThat(ListNumbers.binarySearchValueOrLower(values, 10), equalTo(10)); assertThat(ListNumbers.binarySearchValueOrLower(values, 2), equalTo(1)); assertThat(ListNumbers.binarySearchValueOrLower(values, 3), equalTo(2)); assertThat(ListNumbers.binarySearchValueOrLower(values, 5), equalTo(5)); assertThat(ListNumbers.binarySearchValueOrLower(values, 9), equalTo(9)); assertThat(ListNumbers.binarySearchValueOrLower(values, 2.5), equalTo(1)); assertThat(ListNumbers.binarySearchValueOrLower(values, 0.5), equalTo(0)); assertThat(ListNumbers.binarySearchValueOrLower(values, 10), equalTo(10)); }
@Test public void binarySearchValueOrLower2() { ListNumber values = new ArrayDouble(1,2,2,2,2,2,2,2,2,2,3); assertThat(ListNumbers.binarySearchValueOrLower(values, 2), equalTo(1)); }