@@ -0,0 +1,2932 @@
+import java.util.Scanner;%0A%0A/**%0A * Merge Sort%0A *%0A */%0Apublic class MergeSort %7B%0A    private int%5B%5D array;%0A    private int%5B%5D tempMergArr;%0A    private int length;%0A%0A    /**%0A     * Sorts %7B@code inputArr%7D with merge sort algorithm.%0A     *%0A     * @param inputArr%0A     */%0A    public final void sort(int inputArr%5B%5D) %7B%0A        this.array = inputArr;%0A        this.length = inputArr.length;%0A        this.tempMergArr = new int%5Bthis.length%5D;%0A        this.mergeSort(0, this.length - 1);%0A    %7D%0A%0A    /**%0A     * Partitions Array into recursively smaller pieces.%0A     *%0A     * @param lowerIndex%0A     *            lower bound to include in the first partition%0A     * @param higherIndex%0A     *            upper bound to include in the third partition%0A     */%0A    private void mergeSort(int lowerIndex, int higherIndex) %7B%0A        if (lowerIndex %3C higherIndex) %7B%0A            int middle = lowerIndex + (higherIndex - lowerIndex) / 2;%0A            // Below step sorts the left side of the array%0A            this.mergeSort(lowerIndex, middle);%0A            // Below step sorts the right side of the array%0A            this.mergeSort(middle + 1, higherIndex);%0A            // Now merge both sides%0A            this.mergeParts(lowerIndex, middle, higherIndex);%0A        %7D%0A    %7D%0A%0A    /**%0A     * Merges partitions.%0A     *%0A     * @param lowerIndex%0A     * @param middle%0A     * @param higherIndex%0A     */%0A    private void mergeParts(int lowerIndex, int middle, int higherIndex) %7B%0A        for (int i = lowerIndex; i %3C= higherIndex; i++) %7B%0A            this.tempMergArr%5Bi%5D = this.array%5Bi%5D;%0A        %7D%0A        int i = lowerIndex;%0A        int j = middle + 1;%0A        int k = lowerIndex;%0A        while (i %3C= middle && j %3C= higherIndex) %7B%0A            if (this.tempMergArr%5Bi%5D %3C= this.tempMergArr%5Bj%5D) %7B%0A                this.array%5Bk%5D = this.tempMergArr%5Bi%5D;%0A                i++;%0A            %7D else %7B%0A                this.array%5Bk%5D = this.tempMergArr%5Bj%5D;%0A                j++;%0A            %7D%0A            k++;%0A        %7D%0A        while (i %3C= middle) %7B%0A            this.array%5Bk%5D = this.tempMergArr%5Bi%5D;%0A            k++;%0A            i++;%0A        %7D%0A%0A    %7D%0A%0A    /**%0A     * Gets input to sort.%0A     *%0A     * @return unsorted array of integers to sort%0A     */%0A    public static int%5B%5D getInput() %7B%0A        final int numElements = 6;%0A        int%5B%5D unsorted = new int%5BnumElements%5D;%0A        Scanner input = new Scanner(System.in);%0A        System.out.println(%22Enter any 6 Numbers for Unsorted Array : %22);%0A        for (int i = 0; i %3C numElements; i++) %7B%0A            unsorted%5Bi%5D = input.nextInt();%0A        %7D%0A        input.close();%0A        return unsorted;%0A    %7D%0A%0A    /**%0A     * Main Method.%0A     *%0A     * @param args%0A     */%0A    public static void main(String args%5B%5D) %7B%0A        int%5B%5D inputArr = getInput();%0A        MergeSort mergeSort = new MergeSort();%0A        mergeSort.sort(inputArr);%0A        for (int i : inputArr) %7B%0A            System.out.print(i);%0A            System.out.print(%22 %22);%0A        %7D%0A    %7D%0A%7D%0A

Create MergeSort.java