Java Array Sub Array subArray(Object in[], int start, int end)

Here you can find the source of subArray(Object in[], int start, int end)

Description

Return a subset of an array.

License

Open Source License

Parameter

Parameter Description
in a parameter
start a parameter
end a parameter

Declaration

public static Object[] subArray(Object in[], int start, int end) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*  w w  w  .  j  a v  a  2s . co  m*/
     * Return a subset of an array.
     * 
     * @param in
     * @param start
     * @param end
     * @return
     */
    public static Object[] subArray(Object in[], int start, int end) {
        Object[] ret = new Object[end - start + 1];
        int j = 0;
        for (int i = start; i <= end; i++) {
            ret[j++] = in[i];
        }
        return ret;
    }
}

Related

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