Use MergeSort to process user input
<p>I want to sort an input(from command line arguments) set of numbers, been stucking here for 3days without finding the error of my codes...really desperate...</p>

<p>Will anyone please give me a hint?</p>

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

public class MergeSorter 
{

    public MergeSorter(int[] anArray)
    {
        a = anArray;
    }
    public void sort()
    {
          if (a.length &lt;= 1) return;
          int[] first = new int[a.length / 2];
          int[] second = new int[a.length - first.length];

          System.arraycopy(a, 0, first, 0, first.length);
          System.arraycopy(a, first.length, second, 0, second.length);

          MergeSorter firstSorter = new MergeSorter(first);
          MergeSorter secondSorter = new MergeSorter(second);
          firstSorter.sort();
          secondSorter.sort();
          merge(first, second);
    }
    private void merge(int[] first, int[] second)
    {
        int iFirst = 0;
        int iSecond = 0;
        int j = 0;
        while (iFirst &lt; first.length &amp;&amp; iSecond &lt; second.length) 
        {
            if (first[iFirst] &lt; second[iSecond])
            {
                a[j] = first[iFirst];
                iFirst++;
            }
            else
            {
                a[j] = second[iSecond];
                iSecond++;
            }
            j++;
        }
          System.arraycopy(first, iFirst, a, j, first.length - iFirst);
          System.arraycopy(second, iSecond, a, j, second.length - iSecond);
       }
    private int[] a;

    public static void main(String[] args)
    {
        int[] a = new int[args.length];
        for (int i = 0; i &lt; args.length; i++) 
        {
            a[i] = Integer.parseInt(args[i]);
        }
        MergeSorter sorter = new MergeSorter(a);
        sorter.sort();
        System.out.println(Arrays.toString(a));
    }
}
</code></pre>
