Java Array Copy copyArrayCutFirst(String[] arr)

Here you can find the source of copyArrayCutFirst(String[] arr)

Description

Utility function that copies a string array except for the first element

License

Apache License

Parameter

Parameter Description
arr Original array of strings

Return

Copied array of strings

Declaration

public static String[] copyArrayCutFirst(String[] arr) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from ww  w  .  j  av a  2  s  .  c o  m*/
     * Utility function that copies a string array except for the first element
     * 
     * @param arr Original array of strings
     * @return Copied array of strings
     */
    public static String[] copyArrayCutFirst(String[] arr) {
        if (arr.length > 1) {
            String[] arrCopy = new String[arr.length - 1];
            System.arraycopy(arr, 1, arrCopy, 0, arrCopy.length);
            return arrCopy;
        } else {
            return new String[0];
        }
    }
}

Related

  1. copyArray(String[] originalArray)
  2. copyArray(T[] array)
  3. copyArray(T[] original)
  4. copyArray2(Object v, int len)
  5. copyArrayAddFirst(String[] arr, String add)
  6. copyArrayExceptLast(String[] array)
  7. copyArrayMax(int[] local, int[] merged)
  8. copyArrayRange(final byte[] value, int start, int end)
  9. copyArrays(byte[] dest, byte[] source, int fromIdx)