Ill try to clarify.
I have:
public static void main(String[] args) {
int a[] = {5, 6 ,7 ,8 ,9 ,10};
removeArray takeOff = new removeArray();
takeOff.remove(3);
for (int i = 0 ; i < a.length ; i++){
System.out.print(" "+a[i]);
}
}
That should print out:
5, 6, 7, 9, 10.
The problem is the remove method, how should I write that. I have:
public class removeArray {
public void remove(int index) {
if (index > 0) {
System.arraycopy(testThatArray.a, 0, testThatArray.a, 0, index);
}
if (index < testThatArray.a.length - 1) {
System.arraycopy(testThatArray.a, index + 1, testThatArray.a, index, testThatArray.a.length - index - 1);
}
}
}
Still, no?
UPDATE:
I got it to print 5 6 7 9 10 10
, how can i remove the last value?