title: Mergesort split into 2 arrays
body: <p>I'm trying to do an assignment, but I can't get this mergesort right. We basically have to make a new version of merge sort. First receiving the original array to sort, then we have to split it into 2 subarrays and then merge them back together on another method.</p>
  <p>I CAN'T CHANGE how the methods are created, no changing what the type of return or the parameters, I can only change the body of it.</p>
  <p>This is my code so far. The instructions of each method are stated at the top of it. (It is in Spanish D:)</p>
  <pre><code>/**
       * SII i&lt;=f: devuelve un array con los elementos del subarray 
       * v[i, f] ordenados Asc. 
       * 
       * @param v  Sus elementos implementan la interfaz Comparable
       * @param i  Extremo inferior del intervalo a ordenar
       * @param f  Extremo superior del intervalo a ordenar
       * @return T[], el array resultante de ordenacion de v[i, f]
       */
      private static &lt;T extends Comparable&lt;T&gt;&gt; T[] mergeSort2(T[] v,
                                                               int i, int f) {
          T[] resultado = (T[]) new Comparable[f-i+1];                                                        
          if (i &lt; f) {
              int m = (i + f) / 2;
              T[] v1 = Arrays.copyOfRange(v, i, m);
              T[] v2 = Arrays.copyOfRange(v, m, f);
              v1 = mergeSort2(v, i, m);
              v2 = mergeSort2(v, m + 1, f);
              resultado = merge2(v1, v2);
          }
          return resultado;
      }        
      
      /**
       * Devuelve el array mezcla de v1 y v2, dos arrays ordenados Asc.
       * 
       * @param v1  Sus elementos implementan la interfaz Comparable
       * @param v2  Sus elementos implementan la interfaz Comparable
       * @return T[], el array resultante de la fusion de v1 y v2
       */
      
      private static &lt;T extends Comparable&lt;T&gt;&gt; T[] merge2(T[] v1, T[] v2) {
          T[] aux = (T[]) new Comparable[v1.length + v2.length];
          int i = 0, j = 0, k = 0;
          while (i &lt; v1.length &amp;&amp; j &lt; v2.length)  
             aux[k++] = v1[i].compareTo(v2[j]) &lt; 0 ? v1[i++] :  v2[j++];
      
          while (i &lt; v1.length)  
              aux[k++] = v1[i++];
      
          while (j &lt; v2.length)    
              aux[k++] = v2[j++];
      
          return aux;
      }
  </code></pre>
  <p>I've been trying this all day. Please help!</p>