private <T>T[] concat(T[] first,T[] second,Class<?> cls){
  Collection<T> res=new ArrayList<>();
  res.addAll(Arrays.asList(first));
  res.addAll(Arrays.asList(second));
  return res.toArray((T[])Array.newInstance(cls,res.size()));
}

private < T > T [ ] concat ( T [ ] first , T [ ] second , Class < ? > cls ) { Collection < T > res = new ArrayList < > ( ) ; res . addAll ( Arrays . asList ( first ) ) ; res . addAll ( Arrays . asList ( second ) ) ; return res . toArray ( ( T [ ] ) Array . newInstance ( cls , res . size ( ) ) ) ; }
returns a new array that contains the concatenated contents of two arrays .
