Is this a proper implementation of mergesort?
<p>I'm worried that the creation of 3 arrays for every recursion step might take up too much space, but I really couldn't figure out another way of doing it. Please tell me whatever is wrong with it.</p>

<pre class="lang-java prettyprint-override"><code>public static int[] split(int [] vector){

    if(vector.length &lt;= 1 || vector == null) 
        return vector;
    int len = vector.length;

    int[] list1 = new int[len / 2];
    // If the number of elements is odd the second list will be bigger
    int[] list2 = new int[len / 2 + (len % 2)];

    // Here we assign the elements to 2 separate lists
    for(int x = 0; x &lt; len / 2; x++)
        list1[x] = vector[x];
    for(int j = 0, i = len / 2; j &lt; list2.length; i++, j++)
        list2[j]=vector[i];

    // Apply the recursion, this will eventually order the lists
    list1 = split(list1);
    list2 = split(list2);

    // Here we take the 2 ordered lists and merge them into 1
    int i = 0, a = 0, b = 0;
    int[] listfinal = new int[len];
    while(i &lt; len){
        if(a &gt;= list1.length){
            listfinal[i] = list2[b]; 
            b++;
        } else if(b &gt;= list2.length){
            listfinal[i] = list1[a]; 
            a++;
        } else if(list1[a] &lt;= list2[b]){
            listfinal[i] = list1[a]; 
            a++;
        } else if(list1[a] &gt; list2[b]){
            listfinal[i] = list2[b]; 
            b++;
        }
        i++;
    }
    return listfinal; // Return the merged and ordered list
}
</code></pre>
