Reputation: 11
This is probably a dumb question but I have hit a brick wall. I'm stuck. I want to add the contents in index 4 of array 1 into index 0 of array 2 then add the contents of index 4+32 in array 1 to index 1 of array 2 and so forth. Array 1 is an existing array and array 2 is being filled by a "jumping" selection coming out of array 1. I have tried everything including converting the first array into a list but it just gets messy. and array copy seems to just copy the entire array across. I would like to do this on the fly: for (int ab = 0; ab <5; ab++){ if (ac
Upvotes: 1
Views: 774
Reputation: 11244
So is this it?
int fromIndex = 4
int toIndex = 0;
while (fromIndex < array1.length)
{
array2[toIndex ] = array1[fromIndex];
fromIndex+=32;
toIndex++;
}
Upvotes: 2