int normalizeIndex(int index) {
        int mod = index % NUMBER_OF_BUCKETS;
        return mod >= 0 ? mod : mod + NUMBER_OF_BUCKETS;
    }
@Test
    public void normalizeIndex() {

        SlidingTimeWindowMovingAverages stwm = new SlidingTimeWindowMovingAverages();

        assertThat(stwm.normalizeIndex(0)).isEqualTo(0);
        assertThat(stwm.normalizeIndex(900)).isEqualTo(0);
        assertThat(stwm.normalizeIndex(9000)).isEqualTo(0);
        assertThat(stwm.normalizeIndex(-900)).isEqualTo(0);

        assertThat(stwm.normalizeIndex(1)).isEqualTo(1);

        assertThat(stwm.normalizeIndex(899)).isEqualTo(899);
        assertThat(stwm.normalizeIndex(-1)).isEqualTo(899);
        assertThat(stwm.normalizeIndex(-901)).isEqualTo(899);
    }