@SuppressWarnings("unchecked")
  public static <T> T[] concat(Class<T> type, T[]... arrays) {
    T[] result = (T[]) Array.newInstance(type, totalLength(arrays));

    int currentLength = 0;

    for (T[] array : arrays) {
      int length = array.length;
      if (length > 0) {
        System.arraycopy(array, 0, result, currentLength, length);
        currentLength += length;
      }
    }

    return result;
  }
@Test
  public void testConcatWithSingleArray() {
    Boolean[] array = {true, false};
    Boolean[] result = ArrayUtil.concat(Boolean.class, array);
    assertThat(result).isEqualTo(new Boolean[] {true, false});
  }