@Test public void testMultiBits() {

    final int sequenceBits = 8;
    final int workerBits = 14;
    // Create an array of 10 workers, each with an unique ID
    final IdGenerator workers[] = new IdGenerator[10];
    for (int i = 0; i < workers.length; i++) {
        workers[i] = new IdGenerator(i * 100, workerBits, sequenceBits);
    }
    final Set<Long> ids = new HashSet<Long>();
    // Let each worker create a lot of IDs (more than can fit in a single sequence)
    for (long i = 0; i < (long) (Math.pow(2, sequenceBits) * 10); i++) {
        for (int j = 0; j < workers.length; j++) {
            long id = workers[j].getNextId();
            if (ids.contains(id)) {
                fail(id + " is already generated by the IdGenerator");
            }
            ids.add(workers[j].getNextId());
        }
    }
}