### Question:
TLD { public static ArrayList<Integer> lastInstancesOf(int b, ByteSequence sequence, int repeat) { ArrayList<Integer> positions = Lists.newArrayList(); for (int i = sequence.length() - 1; i >= 0 && positions.size() != repeat; --i) { if (sequence.byteAt(i) == b) { positions.add(i); } } return positions; } private  TLD(); static ByteSequence parsePointerFromFI(ByteSequence cq); static ByteSequence parseParentPointerFromId(ByteSequence id); static ByteSequence parseFieldAndValueFromFI(ByteSequence cf, ByteSequence cq); static ByteSequence parseFieldAndValueFromTF(ByteSequence cq); static ByteSequence parseRootPointerFromFI(ByteSequence cq); static ByteSequence parseRootPointerFromId(ByteSequence id); static String parseRootPointerFromId(String id); static ByteSequence estimateRootPointerFromId(ByteSequence id); static boolean isRootPointer(ByteSequence id); static ByteSequence fromString(String s); static ArrayList<Integer> instancesOf(int b, ByteSequence sequence); static ArrayList<Integer> instancesOf(int b, ByteSequence sequence, int repeat); static ArrayList<Integer> lastInstancesOf(int b, ByteSequence sequence, int repeat); static Key buildParentKey(Text shard, ByteSequence id, ByteSequence cq, Text cv, long ts); static Key getNextParentKey(Key docKey);  }### Answer:
@Test public void testLastInstancesOf() { ByteSequence bytes = new ArrayByteSequence("how.many.dots.do.we.have?"); ArrayList<Integer> expectedPositions = Lists.newArrayList(19, 16, 13, 8, 3); ArrayList<Integer> instances = TLD.lastInstancesOf('.', bytes, -1); assertEquals(expectedPositions, instances); }
@Test public void testLastInstancesOfWithRepeat() { ByteSequence bytes = new ArrayByteSequence("how.many.dots.do.we.have?"); ArrayList<Integer> expectedPositions = Lists.newArrayList(19, 16, 13); ArrayList<Integer> instances = TLD.lastInstancesOf('.', bytes, 3); assertEquals(expectedPositions, instances); }