Java Array Range Copy copyOf(String[] original, int newLength)

Here you can find the source of copyOf(String[] original, int newLength)

Description

copy Of

License

Open Source License

Declaration

public static String[] copyOf(String[] original, int newLength) 

Method Source Code

//package com.java2s;

public class Main {
    public static String[] copyOf(String[] original, int newLength) {
        return copyOfRange(original, 0, newLength);
    }//from  ww w.jav  a  2 s  .co m

    public static String[] copyOfRange(String[] original, int from, int newLength) {
        String[] copy = new String[newLength];
        newLength = Math.min(original.length - from, newLength);
        System.arraycopy(original, from, copy, 0, newLength);
        return copy;
    }
}

Related

  1. copyOf(Integer[] original)
  2. copyOf(Object src, int newLength)
  3. copyOf(Object[] array, int newLength)
  4. copyOf(Object[] values, int nlen)
  5. copyOf(String[] data, int newLength)
  6. copyOf(T[] oriArray, int newArraySize, int startOffset)
  7. copyOfArray(int[] a)
  8. copyOfRange(byte[] bytes, int offset, int len)
  9. copyOfRange(byte[] original, int from, int to)