Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Arrays;

public class Main {

    public static int[] mergeSort(int[] source1, int[] source2) {
        int count1 = source1.length;
        int count2 = source2.length;
        int count = count1 + count2;
        int array[] = new int[count];
        for (int i = 0; i < count; i++) {
            if (i < count1) {
                array[i] = source1[i];
            } else {
                array[i] = source2[i - count1];
            }
        }
        Arrays.sort(array);
        return array;
    }
}