In a nutshell
This piece of code "cuts out" from the input sequence the first element with the value of searchKey
And now more:
searchKey - the desired value in the sequence
for(j=0;j<nElems;j++) - pass through the sequence from 0 to nElems (most likely it is the length of the sequence)
if(arr[j]==searchKey) { break; } if(arr[j]==searchKey) { break; } - if the j-th element of the sequence arr is equal to searchKey (in this case 55), then break (stop the cycle, while j = the index of the element with the value searchkey
for(int k = j;k<nElems-1;k++){ arr[k] = arr[k+1]; }
Passing through the same sequence, only now not from the beginning to the end, but from j to nElems - 1 and the current elements of the sequence are assigned the value of the following (in other words, we cut the element with the value of searchKey )
nElems-- - reduce the length of the sequence by one.
But, frankly, I absolutely agree with the speaker in the comments. You use an array and "cut out" the value from it, but, to be honest, cutting cannot be called cutting. Since you substitute the remaining elements of the array instead, but this does not change its size, it both consisted of n elements and consists of.
ArrayList, which automatically updates the size and cleans holes when inserting, deleting, etc. - Flippy