### Question:
ReverseComparableCharSequence implements ComparableCharSequence { @Override public ComparableCharSequence subSequence(final int start, final int end) { if (start < 0 || start > end || end > length) { throw new StringIndexOutOfBoundsException(String.format("begin %s, end %s, length %s", start, end, length)); } return new ReverseComparableCharSequence(sequence.subSequence(this.length - end, this.length - start)); } ReverseComparableCharSequence(final CharSequence sequence); @Override int length(); @Override char charAt(final int index); @Override ComparableCharSequence subSequence(final int start, final int end); @Override int compareTo(final CharSequence other); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString();  }### Answer:
@Test public void testSubSequence() { ReverseComparableCharSequence revSeq = new ReverseComparableCharSequence("abcdefg"); assertEquals(seq("gfe"), revSeq.subSequence(0, 3)); assertEquals(seq("gfedcba"), revSeq.subSequence(0, 7)); assertEquals(seq("dcba"), revSeq.subSequence(3, 7)); assertEquals(seq("dc"), revSeq.subSequence(3, 5)); assertEquals(seq("edc"), revSeq.subSequence(1, 6).subSequence(1, 4)); }