### Question:
Long2DoubleSortedArrayMap extends AbstractLong2DoubleSortedMap { @Override public Long2DoubleSortedArrayMap subMap(long from, long to) { int startIdx = keys.findLowerBound(from); int endIdx = keys.findLowerBound(to); return createSubMap(startIdx, endIdx); } Long2DoubleSortedArrayMap(SortedKeyIndex ks, double[] vs); @Deprecated  Long2DoubleSortedArrayMap(Map<Long,Double> data); static Long2DoubleSortedArrayMap create(Long2DoubleMap input); static Long2DoubleSortedArrayMap wrap(SortedKeyIndex keys, double[] vs); static Long2DoubleSortedArrayMap wrapUnsorted(long[] keys, double[] values); static Long2DoubleSortedArrayMap fromArray(KeyIndex mapping, double[] values); static Long2DoubleSortedArrayMap fromArray(KeyIndex mapping, DoubleList values); @SuppressWarnings("deprecation") static Long2DoubleSortedArrayMap create(Map<Long,Double> data); @Override FastSortedEntrySet long2DoubleEntrySet(); @Override LongSortedArraySet keySet(); long getKeyByIndex(int i); double getValueByIndex(int i); @Override LongComparator comparator(); @Override Long2DoubleSortedArrayMap subMap(long from, long to); Long2DoubleSortedArrayMap subMap(LongSet toKeep); @Override Long2DoubleSortedMap headMap(long l); @Override Long2DoubleSortedMap tailMap(long l); @Override long firstLongKey(); @Override long lastLongKey(); @Override double get(long l); @Override boolean containsKey(long k); @Override int size();  }### Answer:
@Test public void testSubMap() { SortedKeyIndex idx = SortedKeyIndex.create(1, 2, 3, 4, 5); double[] values = { 1.5, 2.4, -3.2, 4.3, -5.7 }; Long2DoubleSortedArrayMap map = new Long2DoubleSortedArrayMap(idx, values); assertThat(map.size(), equalTo(5)); Long2DoubleSortedMap sub = map.subMap(LongUtils.packedSet(2L, 4L)); assertThat(sub.size(), equalTo(2)); assertThat(sub.containsKey(2L), equalTo(true)); assertThat(sub.containsKey(1L), equalTo(false)); assertThat(sub.containsKey(5L), equalTo(false)); assertThat(sub.containsKey(4L), equalTo(true)); assertThat(sub.containsKey(3L), equalTo(false)); assertThat(sub.keySet(), contains(2L, 4L)); assertThat(sub, hasEntry(2L, 2.4)); assertThat(sub, hasEntry(4L, 4.3)); }