@SuppressWarnings({"unchecked"}) public static <T>T[] join(Class<T> componentType,T[][] arrays){
  if (arrays.length == 1) {
    return arrays[0];
  }
  int length=0;
  for (  T[] array : arrays) {
    length+=array.length;
  }
  T[] result=(T[])Array.newInstance(componentType,length);
  length=0;
  for (  T[] array : arrays) {
    System.arraycopy(array,0,result,length,array.length);
    length+=array.length;
  }
  return result;
}

@ SuppressWarnings ( { "unchecked" } ) public static < T > T [ ] join ( Class < T > componentType , T [ ] [ ] arrays ) { if ( arrays . length == 1 ) { return arrays [ 0 ] ; } int length = 0 ; for ( T [ ] array : arrays ) { length += array . length ; } T [ ] result = ( T [ ] ) Array . newInstance ( componentType , length ) ; length = 0 ; for ( T [ ] array : arrays ) { System . arraycopy ( array , 0 , result , length , array . length ) ; length += array . length ; } return result ; }
joins arrays using provided component type .
