Java Array Sub Array subarray(int[] array, int offset, int length)

Here you can find the source of subarray(int[] array, int offset, int length)

Description

subarray

License

Open Source License

Declaration


public static int[] subarray(int[] array, int offset, int length) 

Method Source Code

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

public class Main {

    public static int[] subarray(int[] array, int offset, int length) {
        if (offset > array.length - 1 || offset + length > array.length)
            return new int[] {};

        int select[] = new int[length];

        for (int i = 0; i < length; i++)
            select[i] = array[offset + i];

        return select;
    }/* w  ww .j  av a2 s .  c o  m*/
}

Related

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