Here you can find the source of copyArrayAddFirst(String[] arr, String add)
Parameter | Description |
---|---|
arr | Original array of strings |
add | a parameter |
public static String[] copyArrayAddFirst(String[] arr, String add)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w. j a va 2 s . c om*/ * Utility function that copies a string array and add another string to * first * * @param arr Original array of strings * @param add * @return Copied array of strings */ public static String[] copyArrayAddFirst(String[] arr, String add) { String[] arrCopy = new String[arr.length + 1]; arrCopy[0] = add; System.arraycopy(arr, 0, arrCopy, 1, arr.length); return arrCopy; } }