ByteTrackerExtent implements CycleResultSegmentsReadable { public long markResult(long cycle, int result) { if (cycle < min) { return cycle - min; } if (cycle >= min + size) { ByteTrackerExtent next = this.nextExtent.get(); if (next != null) { return next.markResult(cycle, result); } else { return (min + size) - cycle; } } int position = (int) (cycle - min); byte resultCode = (byte) (result & 127); try { markerData[position] = resultCode; } catch (Exception e) { e.printStackTrace(); } int i = totalMarked.incrementAndGet(); return (size - i); } ByteTrackerExtent(long min, long nextMin);  ByteTrackerExtent(long min, int[] ints); long markResult(long cycle, int result); CycleResultsIntervalSegment getRemainingSegment(); @Override String toString(); boolean isFullyFilled(); AtomicReference<ByteTrackerExtent> getNextExtent(); ByteTrackerExtent extend(); long getMin(); int getSize(); int getChainSize(); String rangeSummary(); @Override Iterator<CycleResultsSegment> iterator();  }
@Test public void testFullCounter() { ByteTrackerExtent bt4 = new ByteTrackerExtent(33, 37); assertThat(bt4.markResult(36L,3)).isEqualTo(3); assertThat(bt4.markResult(33L,0)).isEqualTo(2); assertThat(bt4.markResult(35L,2)).isEqualTo(1); assertThat(bt4.markResult(35L,2)).isEqualTo(0); assertThat(bt4.markResult(33L,9)).isEqualTo(-1); }