public boolean hasData(final long address, final int length) {
    Preconditions.checkArgument(address >= 0, "Error: Address can't be less than 0");
    Preconditions.checkArgument(length > 0, "Error: Length must be positive");

    try {
      m_readLock.lock();

      MemoryChunk nextChunk = findChunk(address);
      int nextLength = length;
      long nextAddress = address;

      do {
        if (nextChunk == null) {
          // The chunk with the address could not be found
          // => The data is not available.
          return false;
        } else if (((nextChunk.getAddress() + nextChunk.getLength()) - nextAddress) >= nextLength) {
          // Enough data is available in the chunk.
          // => The data is available.
          return true;
        } else {
          // There is not enough data available in the
          // current chunk but the data could be in the
          // next chunk.

          // The next length is the required length minus
          // the length of the current chunk that was consumed.
          nextLength -= (nextChunk.getAddress() + nextChunk.getLength()) - nextAddress;

          // The next address is exactly the address behind
          // the current chunk because the whole current chunk
          // was consumed already.
          nextAddress = nextChunk.getAddress() + nextChunk.getLength();

          nextChunk = findChunk(nextAddress);
        }

      } while (true);
    } finally {
      m_readLock.unlock();
    }
  }
Determines whether the memory has length bytes starting from the given address.

@param address The start address.
@param length The length of the data.
@return True, if all bytes in the given range are available. False, otherwise.
@throws IllegalArgumentException Thrown if the address is negative or if the length is not
    positive.
java/zylib/src/main/java/com/google/security/zynamics/zylib/general/memmanager/Memory.java