adding logic to avoid integer overflow of numStreams * maxWindowSize.