Is there a simpler way to write this code, recursively?
<p>The goal for me is to write a method that takes 2 String array and sort the elements in the array by how long each element is. By Using Merge Sort???</p>

<p>This is the code that I have but I want it to be more condensed and I dont know if this code is recursive.</p>

<pre><code>import java.util.Arrays;
import java.util.Comparator;

public class Test {

    private static Comparator&lt;String&gt; COMP = new Comparator&lt;String&gt;() {
        @Override
        public int compare(String o1, String o2) {
            if(o1.length() &lt; o2.length()) {
                return -1;
            }
            if(o1.length() &gt; o2.length()) {
                return 1;
            }
            return o1.compareToIgnoreCase(o2);
        }
    };

    public static String[] mergeUnsorted(String[] arr1, String[] arr2) {
        arr1 = sort(arr1);
        arr2 = sort(arr2);

        return merge(arr1, arr2);
    }

    private static String[] sort(String[] arr) {
        if(arr.length &lt;= 1)
            return arr;

        String[] left = Arrays.copyOfRange(arr, 0, arr.length/2);
        String[] right = Arrays.copyOfRange(arr, arr.length/2, arr.length);

        left = sort(left);
        right = sort(right);

        String[] combined = merge(left, right);

        return combined;
    }

    private static String[] merge(String[] arr1, String[] arr2) {
        String[] combined = new String[arr1.length + arr2.length];

        int a = 0, b = 0, i = 0;

        while(a &lt; arr1.length || b &lt; arr2.length) {
            int compare = 0;
            if(a &gt;= arr1.length) {
                compare = 1;
            } else if(b &gt;= arr2.length) {
                compare = -1;
            } else {
                compare = COMP.compare(arr1[a], arr2[b]);
            }

            if(compare &lt; 0) {
                combined[i] = arr1[a];
                i++;
                a++;
            } else if(compare &gt; 0) {
                combined[i] = arr2[b];
                i++;
                b++;
            } else {
                combined[i] = arr1[a];
                i++;
                a++;
                combined[i] = arr2[b];
                i++;
                b++;
            }
        }

        return combined;
    }

    public static void main(String[] args) {
        String[] arr1 = new String[] { "abc", "a", "A", "bA", "Ba" };
        String[] arr2 = new String[] { "def", "d", "D", "fG", "Fg", "abcde", "B" };

        System.out.println(Arrays.toString(mergeUnsorted(arr1, arr2)));
    }
}
</code></pre>
