I have an array with 8 elements, and I need to remove the first element from it and copy it to the same array. I tried it using System.arraycopy(...) but the size of the array did not change.
int[] array = {90,78,67,56,45,34,32,31};
System.arraycopy(array, 1, array, 0, array.length-1);
what I need is, the array should consist 78,67,56,45,34,32,31 elements with the array size of 7
there is a way to do this by copying this to another array and assigning it to the first array
int arrayB = new int[array.length-1];
System.arraycopy(array, 1, arrayB, 0, array.length-1);
array = arrayB;
but this is not the way I want. I need it to be done without the help of another array.