### Question:
RangeLongBlock implements Comparable<RangeLongBlock>, Iterable<Long> { public static List<RangeLongBlock> createRangeLongBlocks(Collection<? extends Long> values) { List<RangeLongBlock> resultBlocks = new LinkedList<>(); if (values != null && !values.isEmpty()) { if (values.size() == 1) { long val = values.iterator().next().longValue(); resultBlocks.add(new RangeLongBlock(val)); } else { List<Long> valuesToUse = new ArrayList<>(values); Collections.sort(valuesToUse); Iterator<Long> valueItr = valuesToUse.iterator(); long lastStart = valueItr.next().longValue(); long lastVal = lastStart; long curVal = 0; while (valueItr.hasNext()) { curVal = valueItr.next().longValue(); if (curVal != lastVal && curVal != lastVal + 1) { resultBlocks.add(new RangeLongBlock(lastStart, lastVal)); lastStart = curVal; } if (!valueItr.hasNext()) { resultBlocks.add(new RangeLongBlock(lastStart, curVal)); } lastVal = curVal; } } } return resultBlocks; } RangeLongBlock(long value);  RangeLongBlock(long startValue, long endValue);  RangeLongBlock(RangeLongBlock other); static List<RangeLongBlock> createRangeLongBlocks(Collection<? extends Long> values); static List<RangeLongBlock> createRangeLongBlocks(long[] values); static List<RangeLongBlock> createRangeLongBlocks(Long[] values); static List<RangeLongBlock> createSubBlocksByRemovingValue(RangeLongBlock block, long valueToRemove); static boolean isContiguous(long[] values); static RangeLongBlock merge(RangeLongBlock one, RangeLongBlock two); boolean borders(long value); boolean borders(RangeLongBlock block); @Override int compareTo(RangeLongBlock o); boolean containsValue(long value); @Override boolean equals(Object obj); boolean formsContiguousRange(RangeLongBlock other); long getEnd(); RangeRelationType getRelation(RangeLongBlock block); long getStart(); @Override int hashCode(); RangeLongBlock intersection(RangeLongBlock other); boolean isAfter(RangeLongBlock other); boolean isBefore(RangeLongBlock other); @Override Iterator<Long> iterator(); boolean overlaps(RangeLongBlock other); int size(); @Override String toString();  }### Answer:
@Test public void testStaticCreateRangeLongBlocks() { long[] primativeArray = { 1, 2, 2, 4, 6, 7, 8, -1, 99, 11, 98, 12, -2, 13 }; Long[] objectArray = new Long[primativeArray.length]; Collection<Long> collection = new LinkedList<>(); for (int i = 0; i < primativeArray.length; i++) { objectArray[i] = Long.valueOf(primativeArray[i]); collection.add(Long.valueOf(primativeArray[i])); } LinkedList<RangeLongBlock> blocks = new LinkedList<>(); blocks.add(new RangeLongBlock(-1, -2)); blocks.add(new RangeLongBlock(1, 2)); blocks.add(new RangeLongBlock(4, 4)); blocks.add(new RangeLongBlock(6, 8)); blocks.add(new RangeLongBlock(11, 13)); blocks.add(new RangeLongBlock(98, 99)); List<RangeLongBlock> fromPrim = RangeLongBlock.createRangeLongBlocks(primativeArray); Assert.assertEquals(blocks, fromPrim); List<RangeLongBlock> fromObjectArray = RangeLongBlock.createRangeLongBlocks(objectArray); Assert.assertEquals(blocks, fromObjectArray); List<RangeLongBlock> fromCollection = RangeLongBlock.createRangeLongBlocks(collection); Assert.assertEquals(blocks, fromCollection); }