if (index + length > list.size())
throw new IllegalArgumentException(
"Illegal index or length: sum of the index and the length cannot be greater than the list size");
Membership result[] = new Membership[length];
for (int i = 0; i < length; i++)
result[i] = list.get(i + index);
return result;
}