Comparing two implementations of smoosh()
I think there are issues with both implementaitons, though I do find the first more readable.

The main problem is that neither makes it immediately clear that we are assigning a new value to each element of the input array. I would expect an implementation to look something like this:

public static void smoosh(int[] input) {
  for (int i = 0; i &lt; input.length; i++) {
    input[i] = ...
  }
}


This makes it clear to the reader that each element of the input array will be assigned to.

Now we can keep track of where the next element for our array is coming from:

public static void smoosh(int[] input) {
  int j = 0;
  for (int i = 0; i &lt; input.length; i++) {
    input[i] = j &lt; input.length ? input[j] : -1;
    j++;
    while (j &lt; input.length &amp;&amp; input[i] == input[j]) {
      j++;
    }
  }
}


It's getting hard to read again, so let's split the logic for j into its own method:

public static void smoosh(int[] input) {
  int j = 0;
  for (int i = 0; i &lt; input.length; i++) {
    input[i] = j &lt; input.length ? input[j] : -1;
    j = getNextDifferentIndex(input, j);
  }
}

/** Get the smallest integer j such that j &gt; i and input[i] != input[j].
 * If no such element exists, return an integer greater than or equal to
 * input.length. */
private static int getNextDifferentIndex(int[] input, int i) {
  int j = i + 1;
  while (j &lt; input.length &amp;&amp; input[i] == input[j]) {
    j++;
  }
  return j;
}


Or if you want to stick to the 14-line limit mentioned in the previous question,

public static void smoosh(int[] input) {
  for (int i = 0, j = 0; i &lt; input.length; i++, j = getNextDifferentIndex(input, j)) {
    input[i] = j &lt; input.length ? input[j] : -1;
  }
}

private static int getNextDifferentIndex(int[] input, int i) {
  int j = i + 1;
  while (j &lt; input.length &amp;&amp; input[i] == input[j]) {
    j++;
  }
  return j;
}