"Clear" the vector in this case is not exactly possible because it is saving integers and not references that could receive the value null
.
The maximum you can do is to assign a neutral value (eg zero) to all elements of the vector, if that helps in your program, and keep an extra variable as the counter of the last available position to write a value ( or the last position where a value was written, whatever is best for your program.)
To assign zero to all elements you do this:
for (int i = 0; i < x.length; i++) {
x[i] = 0;
}