Java Array Sub Array subarray(String[] master, int index)

Here you can find the source of subarray(String[] master, int index)

Description

For an array master, returns an array containing the last master.length-index elements.

License

BSD License

Declaration

public static String[] subarray(String[] master, int index) 

Method Source Code

//package com.java2s;
// BSD License (http://www.galagosearch.org/license)

public class Main {
    /**//from  ww w .  j  av a  2s  .  c  o m
     * For an array master, returns
     * an array containing the last master.length-index elements.
     */
    public static String[] subarray(String[] master, int index) {
        if (master.length <= index) {
            return new String[0];
        } else {
            String[] sub = new String[master.length - index];
            System.arraycopy(master, index, sub, 0, sub.length);
            return sub;
        }
    }
}

Related

  1. subArray(Object[] data, int startIndex, int endIndex)
  2. subArray(String a[], int from)
  3. subarray(String[] args, String sep)
  4. subArray(String[] array, int start, int endExclusive)
  5. subArray(String[] data, int index, int length)
  6. subArray(String[] strings, int nStart)
  7. subarray(T[] a, int off, int len)
  8. subArray(T[] array, int start, int end)
  9. subArray(T[] array, int start, int end)