private int hashIndex(int value) throws IOException {
      acquirePage();
      try {
        final ByteBuffer pageBuffer = page.rawPageBuffer();

        final int length = hashPageCapacity;
        int hash = value & 0x7fffffff;
        int index = hash % length;
        int keyAtIndex = keyAtGivenLocksAndBufferAcquired(pageBuffer, index);

        hashSearchRequests++;

        int total = 0;
        if (useDoubleHash) {
          if (keyAtIndex != value && keyAtIndex != HASH_FREE) {
            // see Knuth, p. 529
            final int probe = 1 + (hash % (length - 2));

            do {
              index -= probe;
              if (index < 0) index += length;

              keyAtIndex = keyAtGivenLocksAndBufferAcquired(pageBuffer, index);
              ++total;
              if (total > length) {
                throw new CorruptedException(storage.getFile()); // violation of Euler's theorem
              }
            }
            while (keyAtIndex != value && keyAtIndex != HASH_FREE);
          }
        }
        else {
          while (keyAtIndex != value && keyAtIndex != HASH_FREE) {
            if (index == 0) index = length;
            --index;
            keyAtIndex = keyAtGivenLocksAndBufferAcquired(pageBuffer, index);
            ++total;

            if (total > length) throw new CorruptedException(storage.getFile()); // violation of Euler's theorem
          }
        }

        maxStepsSearchedInHash = Math.max(maxStepsSearchedInHash, total);
        totalHashStepsSearched += total;

        return keyAtIndex == HASH_FREE ? -index - 1 : index;
      }
      finally {
        releasePage();
      }
    }
private int hashIndex(int value)