code: public Object[] mergeArrays(Object[] array1, Object[] array2) {
          Object[] retval = null;
  
          if (array1 == null || array1.length == 0 ||
              array2 == null || array2.length == 0) {
              return retval;
          }
  
          Class<?> cls1 = array1[0].getClass();
          Class<?> cls2 = array2[0].getClass();
  
          if (!cls1.equals(cls2)) {
              return retval;
          }
  
          retval = (Object[]) Array.newInstance(cls1, array1.length + array2.length);
  
          System.arraycopy(array1, 0, retval, 0, array1.length); 
          System.arraycopy(array2, 0, retval, array1.length, array2.length);
  
          return retval;
      }
docs: Merge the two arrays by creating a new array that contains all items from
  array1 followed by all items from array2.  Note that the arrays are
  purely concatenated and any duplicates will remain.  If either array is
  <code>null</code> or empty, then <code>null</code> is returned.  If the
  class types of the arrays are not equal, then <code>null</code> is
  returned.
  
  @param array1 The first array
  @param array2 The second array
  
  @return The concatenation of array1 and array2 together