int insertKeyRehash(byte val, int index, int hash, byte state) {
             // compute the double hash
             final int length = _set.length;
             int probe = 1 + (hash % (length - 2));
             final int loopIndex = index;
             int firstRemoved = -1;

             /**
              * Look until FREE slot or we start to loop
              */
             do {
                 // Identify first removed slot
                 if (state == REMOVED && firstRemoved == -1)
                     firstRemoved = index;

                 index -= probe;
                 if (index < 0) {
                     index += length;
                 }
                 state = _states[index];

                 // A FREE slot stops the search
                 if (state == FREE) {
                     if (firstRemoved != -1) {
                         insertKeyAt(firstRemoved, val);
                         return firstRemoved;
                     } else {
                         consumeFreeSlot = true;
                         insertKeyAt(index, val);
                         return index;
                     }
                 }

                 if (state == FULL && _set[index] == val) {
                     return -index - 1;
                 }

                 // Detect loop
             } while (index != loopIndex);

             // We inspected all reachable slots and did not find a FREE one
             // If we found a REMOVED slot we return the first one found
             if (firstRemoved != -1) {
                 insertKeyAt(firstRemoved, val);
                 return firstRemoved;
             }

             // Can a resizing strategy be found that resizes the set?
             throw new IllegalStateException("No free or removed slots available. Key set full?!!");
         }