Java Array Sub Array subArray(Object a[], int from)

Here you can find the source of subArray(Object a[], int from)

Description

sub Array

License

Apache License

Declaration

public static Object[] subArray(Object a[], int from) 

Method Source Code

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

public class Main {
    public static Object[] subArray(Object a[], int from) {
        if (from == 0)
            return a;
        Object newa[] = new Object[a.length - from];
        System.arraycopy(a, from, newa, 0, newa.length);
        return newa;
    }/*from   www. j a va2s.co m*/

    public static Object[] subArray(Object a[], int from, int to) {
        if (from == 0 && to == a.length)
            return a;
        Object newa[] = new Object[to - from];
        System.arraycopy(a, from, newa, 0, newa.length);
        return newa;
    }

    public static int[] subArray(int a[], int from) {
        if (from == 0)
            return a;
        int newa[] = new int[a.length - from];
        System.arraycopy(a, from, newa, 0, newa.length);
        return newa;
    }
}

Related

  1. subarray(final String[] arr, int first, final int last)
  2. subArray(float[] array, int start)
  3. subarray(int[] array, int offset, int length)
  4. subarray(int[] array, int start, int end)
  5. subArray(int[] array, int startIndex, int theLength)
  6. subArray(Object in[], int start, int end)
  7. subArray(Object[] arr, int start, int length)
  8. subArray(Object[] data, int startIndex, int endIndex)
  9. subArray(String a[], int from)