long position = chunkSizeForFile;
long tailChunkPosition = length - chunkSizeForFile;
// Seek to position of the tail chunk, or not at all if length is smaller than two chunks
while (position < tailChunkPosition && (position += in.skip(tailChunkPosition - position)) >= 0);
// Second chunk, or the rest of the data if length is smaller than two chunks
in.readFully(chunkBytes, chunkSizeForFile, chunkBytes.length - chunkSizeForFile);
head = computeHashForChunk(ByteBuffer.wrap(chunkBytes, 0, chunkSizeForFile));