title: Java Client Server with RMI
body: <p>Write a Java client-server program applying RMI. The client program generate two arrays of type class Integer. The client calls method that is on the server side in a remote object. The server put these two arrays into one array, sort the array and returns the sorted array to the client. The client displays the sorted array on the console. Use the following interface. Do not change it.</p>
  
  <pre><code>import java.util.ArrayList;
  import java.rmi.*;
  
  public interface MergeInterface extends Remote {
    public ArrayList mergeAndSort(ArrayList a, ArrayList b)  throws RemoteException; 
  }
  </code></pre>
  
  <p>The following sequential program is putting two arrays together, sorting array and display:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Collections;
  import java.util.Random;
  
  public class Main {
    public static void main(String[] args) {
      ArrayList&lt;Integer&gt; a = new ArrayList&lt;Integer&gt;();
      ArrayList&lt;Integer&gt; b = new ArrayList&lt;Integer&gt;();
      Random r = new Random();
      int m = r.nextInt(900) + 100;
      for (int i = 0; i &lt; m; i++) {
          a.add(r.nextInt(500) + 10);
      }
      int n = r.nextInt(900) + 100;
      for (int i = 0; i &lt; n; i++) {
          b.add(r.nextInt(500) + 10);
      }
      a.addAll(b);
      Collections.sort(a);
      for (Integer i : a) {
          System.out.println(i);
      }
    }
  }
  </code></pre>