getCurrentLength function
Implementation
int getCurrentLength(List<int> listLengths, int index) {
index = index + 1;
int val = listLengths[0];
for (int i = 0; i < listLengths.length; i++) {
val = i == 0 ? listLengths[0] : listLengths[i] - listLengths[i - 1];
if (listLengths[i] >= index) break;
}
return val;
}