code: public static <T> T[] prependToArray(T item, T[] array, Class<?> type) {
          if (array == null) {
              if (type == null && item != null) {
                  type = item.getClass();
              }
              @SuppressWarnings("unchecked")
              T[] na = (T[]) Array.newInstance(type, 1);
              na[0] = item;
              return na;
          } else {
              Class<?> c = array.getClass().getComponentType();
              @SuppressWarnings("unchecked")
              T[] na = (T[]) Array.newInstance(c, Array.getLength(array) + 1);
              System.arraycopy(array, 0, na, 1, array.length);
              na[0] = item;
              return na;
          }
      }
docs: Add element to the start of an array
  
  @param array The array to add to (or null)
  @param item  The item to add
  @param type  The type of the array (in case of null array)
  @param <T>   the array entry type
  @return new array with contents of array plus item