True, it's not working for me either... Lot's if syntax errors heh.
Anyway in the end I separated it into 2 processes, it seems silly but it works, I basically take the first half, then the second half minus the middle element and then concatenate them together
Like this:
Code:
// Instantiate the array
int[] myCountingArray = new int[100];
// Just as an example I'll populate
// the array with numbers from 1 to 100
for (int i = 0; i < 100; i++){
myCountingArray[i] = i + 1;
}
// then let's say I want to get the middle element
// instantiate two temp arrays
int[] firstHalf = new int[100];
int[] secondHalf = new int[100];
// subset the first half of the array into the firstHalf array
firstHalf = subset(myCountingArray, 0, round(myCountingArray.length / 2));
// subset the second half (minus the middle element) to the secondHalf array
secondHalf = subset(myCountingArray, round(myCountingArray.length / 2) + 1);
// concatenate both
myCountingArray = concat(firstHalf, secondHalf);
The same process can be applied to extract any element really, just instead of using the length/2 it would be replaced with the index of the element we want to extract - 1 on the first subset and then the index on the second subset...
I'm not saying I reinvented the wheel, I'm just merely trying to point out that what I did seems silly but it's the only way I found to do a simple task as removing a desired element from an array (that isn't the last element).
There's probably a quicker and more straightforward solution, hope anyone can share it.