As array.

@param <E> the element type
@param input the input
@param newArray the new array
@return the e[]
187521
public static <E> E[] asArray(List<E> input, E[] newArray) {
		return input.toArray(newArray);
	}
407061
public  int[] compress(int[] input) {
        int [] compressed = new int[input.length + input.length / 100 + 1024];
        compressed[0] = input.length;
        IntWrapper outpos = new IntWrapper(1);
        IntWrapper initvalue = new IntWrapper(0);
		try {
			codec.headlessCompress(input, new IntWrapper(0), input.length, compressed, outpos, initvalue);
		} catch (IndexOutOfBoundsException ioebe) {
			throw new UncompressibleInputException(
					"Your input is too poorly compressible with the current codec : " + codec);
		}
        compressed = Arrays.copyOf(compressed,outpos.intValue());
        return compressed;
    }
649727
public static List<Integer> asList(int[] array) {
    List<Integer> l = new ArrayList<Integer>();
    for (int i : array) {
      l.add(i);
    }
    return l;
  }
974416
public static short[] asShortTypeArray(List<Short> input) {
		short[] result = new short[input.size()];

		for (int i = 0; i < result.length; i++) {
			result[i] = input.get(i);
		}

		return result;
	}
1198357
private static byte[] toBytes(Object input) {
        if (input instanceof byte[]) {
            return (byte[]) input;
        } else if (input instanceof String) {
            String inputString = (String) input;
            return inputString.getBytes();
        } else if (input instanceof Long) {
            Long inputLong = (Long) input;
            return (inputLong == 0) ? ByteUtil.EMPTY_BYTE_ARRAY : asUnsignedByteArray(BigInteger.valueOf(inputLong));
        } else if (input instanceof Integer) {
            Integer inputInt = (Integer) input;
            return (inputInt == 0) ? ByteUtil.EMPTY_BYTE_ARRAY : asUnsignedByteArray(BigInteger.valueOf(inputInt));
        } else if (input instanceof BigInteger) {
            BigInteger inputBigInt = (BigInteger) input;
            return (inputBigInt.equals(BigInteger.ZERO)) ? ByteUtil.EMPTY_BYTE_ARRAY : asUnsignedByteArray(inputBigInt);
        }
        throw new RuntimeException("Unsupported type: Only accepting String, Integer and BigInteger for now");
    }
198153
public static String[] nullifyBadInput(String[] input)
    {
        if (input != null)
        {
            if (input.length > 0)
            {
                return input;
            }
        }
        return null;
    }
586214
@SuppressWarnings("unchecked")
	public static <T> T[] insert(T[] buffer, int index, T... newElements) {
		return (T[]) insert((Object)buffer, index, newElements);
	}
278841
@Override
    public int[] predict(INDArray input) {
        INDArray output = activate(input, false, LayerWorkspaceMgr.noWorkspacesImmutable());
        int[] ret = new int[input.rows()];
        for (int i = 0; i < ret.length; i++)
            ret[i] = Nd4j.getBlasWrapper().iamax(output.getRow(i));
        return ret;
    }
534098
public static String[] trimStringArray(final String[] input) {
        final ArrayList<String> output = new ArrayList<String>();
        for (int i = 0; i < input.length; i++) {
            String s = input[i].trim();
            if (!s.equals("")) output.add(s);
        }
        return output.toArray(new String[0]);
    }
1043590
public static byte[] encodeMultiple(final byte[] input) {

        if (input == null) {
            throw new NullPointerException("input");
        }

        final byte[] output = new byte[input.length << 1]; // * 2

        encodeMultiple(input, 0, output, 0, input.length);

        return output;
    }
249626
public int[] decodeIntArray(String input) throws IOException {
        int[] result = null;
        ByteArrayInputStream bis = 
            new ByteArrayInputStream(Base64.decodeBase64(input));
        DataInputStream dis = new DataInputStream(bis);
        int length = dis.readInt();
        result = new int[length];
        for (int i=0; i < length; i++) {
            result[i] = dis.readInt();
        }
        return result;
    }
1249732
public static <A, E extends A> A[] toArray(Enumeration<E> enumeration, A[] array) {
        ArrayList<A> elements = new ArrayList<>();
        while (enumeration.hasMoreElements()) {
            elements.add(enumeration.nextElement());
        }
        return elements.toArray(array);
    }
368985
public static String[] add(final String[] a, final String element) {
        if (N.isNullOrEmpty(a)) {
            return N.asArray(element);
        }

        final String[] newArray = new String[a.length + 1];

        copy(a, 0, newArray, 0, a.length);
        newArray[a.length] = element;

        return newArray;
    }
442028
@SuppressWarnings("unchecked")
	@Override
	public <T> T[] toArray(T[] array) {
		return (T[])(booleanTerms == null ? new BooleanTerm[0] : booleanTerms.toArray(new BooleanTerm[booleanTerms.size()]));
	}
1055345
@Override
	public int[] toArrayInt() {
		int[] result = new int[size];
		System.arraycopy(elementData, 0, result, 0, size);
		return result;
	}
555700
public static String[] toArrayElement(String s) {
    return (s == null || s.length() == 0) ? new String[0] : new String[]{s};
  }
474570
public static <E> ArrayList<E> newArrayList(Iterator<? extends E> elements) {
		ArrayList<E> list = newArrayList();
		while (elements.hasNext()) {
			list.add(elements.next());
		}
		return list;
	}