You're copying over values into the same indices between the two arrays, leaving blank spots in array.


count = 0;
for (int i = 0; i < arr.length; i++)
{
if (arr[i]!=x)
{
...