Hello! How can I get IntRange of the indexes after...
# getting-started
o
Hello! How can I get IntRange of the indexes after slicing the array of bytes? I slice array in this way:
Copy code
val chunks = data.asIterable().chunked(CHUNK_SIZE)
For example, I need an index (from original array) of first byte in second chunk.
m
For your example, you can compute the index based on your CHUNK_SIZE. If you want the index of the j-th element of the i-th chunk, it’s
i * CHUNK_SIZE + j
👍 1
o
Thanks for the advice, it works