Finding common elements, ignoring duplicates, in two given string arrays
There is one major flaw in your code: Testing strings for value
equality must be done with .equals() not with ==.
For example, for  

commonTwo(new String[]{new String("a"),"b","c"},
          new String[]{"a","b","c"})


your code returns 2 instead of 3. 
(Compare How do I compare strings in Java?.)

Your computation of the larger/shorter array can be simplified to

shortArray = a.length &lt; b.length ? a : b;
longArray = a.length &gt;= b.length ? a : b;


But actually your code does not take advantage of the fact that one array is shorter than the other, so you might as well loop over a
and b directly.

Your letterToAvoid idea works (almost) to skip duplicate elements, but I would call the variable differently, perhaps lastDuplicate.
And you could early-return from the inner loop if a duplicate is found.
Your idea does not work if the string arrays contain empty strings
as well which should also be counted.

Your solution is not efficient. It does not take advantage of the
fact that both arrays are sorted. Instead of a nested loop you
can perform a parallel single iteration over both arrays:


If current left element is smaller than current right element,
advance left position by one.
If current right element is smaller, advance right position.
If current left and right elements are equal, we have found
a duplicate. Skip following equal elements in both arrays.


Possible implementation:

public int commonTwo(String[] a, String[] b){

    int count = 0;

    int i = 0;  // Index into a
    int j = 0;  // Index into b

    while (i &lt; a.length &amp;&amp; j &lt; b.length) {
        int cmp = a[i].compareTo(b[j]);
        if (cmp &lt; 0) {
            // a[i] is smaller
            i++;
        } else if (cmp &gt; 0) {
            // b[j] is smaller
            j++;
        } else {
            // a[i] == b[j] 
            // Increment count and skip duplicates
            count++;
            String lastDuplicate = a[i];
            i++;
            j++;
            while (i &lt; a.length &amp;&amp; a[i].equals(lastDuplicate)) { i++; }
            while (j &lt; b.length &amp;&amp; b[j].equals(lastDuplicate)) { j++; }
        }
    }

    return count;
}