Java Array Sub Array subarray(int[] array, int start, int end)

Here you can find the source of subarray(int[] array, int start, int end)

Description

subarray

License

Open Source License

Declaration

static int[] subarray(int[] array, int start, int end) 

Method Source Code

//package com.java2s;
// license that can be found in the LICENSE file.

public class Main {
    static int[] subarray(int[] array, int start, int end) {
        int[] r = new int[end - start];
        for (int i = start; i < end; ++i) {
            r[i - start] = array[i];/*www.j a  va 2  s  .c  om*/
        }
        return r;
    }

    static byte[] subarray(byte[] array, int start, int end) {
        byte[] r = new byte[end - start];
        for (int i = start; i < end; ++i) {
            r[i - start] = array[i];
        }
        return r;
    }
}

Related

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