### Question:
ImmutableBitSet implements Iterable<Integer>, Serializable, Comparable<ImmutableBitSet> { public ImmutableBitSet shift(int offset) { if (offset == 0) { return this; } final Builder builder = builder(); for (int i = nextSetBit(0); i >= 0; i = nextSetBit(i + 1)) { builder.set(i + offset); } return builder.build(); } private  ImmutableBitSet(long[] words); static ImmutableBitSet of(); static ImmutableBitSet of(int... bits); static ImmutableBitSet of(Iterable<Integer>  bits); static ImmutableBitSet of(ImmutableIntList bits); static ImmutableBitSet valueOf(long... longs); static ImmutableBitSet valueOf(LongBuffer longs); static ImmutableBitSet fromBitSet(BitSet input); static ImmutableBitSet range(int fromIndex, int toIndex); static ImmutableBitSet range(int toIndex); Iterable<ImmutableBitSet> powerSet(); boolean get(int bitIndex); ImmutableBitSet get(int fromIndex, int toIndex); String toString(); boolean intersects(ImmutableBitSet set); int cardinality(); int hashCode(); int size(); boolean equals(Object obj); int compareTo(@Nonnull ImmutableBitSet o); int nextSetBit(int fromIndex); int nextClearBit(int fromIndex); int previousClearBit(int fromIndex); Iterator<Integer> iterator(); List<Integer> toList(); List<Integer> asList(); Set<Integer> asSet(); int[] toArray(); long[] toLongArray(); ImmutableBitSet union(BitSet other); ImmutableBitSet union(ImmutableBitSet other); static ImmutableBitSet union(
      Iterable<? extends ImmutableBitSet> sets); ImmutableBitSet except(ImmutableBitSet that); ImmutableBitSet intersect(ImmutableBitSet that); boolean contains(ImmutableBitSet set1); int indexOf(int bit); static SortedMap<Integer, ImmutableBitSet> closure(
      SortedMap<Integer, ImmutableBitSet> equivalence); int length(); boolean isEmpty(); static Builder builder(); @Deprecated // to be removed before 2.0 static Builder builder(ImmutableBitSet bitSet); Builder rebuild(); int nth(int n); ImmutableBitSet set(int i); ImmutableBitSet set(int i, boolean b); ImmutableBitSet setIf(int bit, boolean condition); ImmutableBitSet clear(int i); ImmutableBitSet clearIf(int i, boolean condition); BitSet toBitSet(); ImmutableBitSet permute(Map<Integer, Integer> map); static Iterable<ImmutableBitSet> permute(
      Iterable<ImmutableBitSet> bitSets,
      final Map<Integer, Integer> map); ImmutableBitSet shift(int offset); static final Comparator<ImmutableBitSet> COMPARATOR; static final Ordering<ImmutableBitSet> ORDERING; @SuppressWarnings("Guava")
  @Deprecated // to be removed before 2.0
  static final com.google.common.base.Function<? super BitSet, ImmutableBitSet> FROM_BIT_SET; }### Answer:
@Test public void testShift() { final ImmutableBitSet bitSet = ImmutableBitSet.of(29, 4, 1969); assertThat(bitSet.shift(0), is(bitSet)); assertThat(bitSet.shift(1), is(ImmutableBitSet.of(30, 5, 1970))); assertThat(bitSet.shift(-4), is(ImmutableBitSet.of(25, 0, 1965))); try { final ImmutableBitSet x = bitSet.shift(-5); fail("Expected error, got " + x); } catch (ArrayIndexOutOfBoundsException e) { assertThat(e.getMessage(), anyOf(is("-1"), is("Index -1 out of bounds for length 0"))); } final ImmutableBitSet empty = ImmutableBitSet.of(); assertThat(empty.shift(-100), is(empty)); }