Java Array Sub Array subset(byte[] a, int begin_index, int len)

Here you can find the source of subset(byte[] a, int begin_index, int len)

Description

subset

License

Open Source License

Declaration

public static byte[] subset(byte[] a, int begin_index, int len) 

Method Source Code

//package com.java2s;

public class Main {

    public static byte[] subset(byte[] a, int begin_index, int len) {
        if (a == null)
            return null;
        if (begin_index < 0 || len <= 0 || begin_index >= a.length || len > a.length - begin_index)
            throw new IllegalArgumentException("Wrong arguments: array length:" + a.length + ", begin index:"
                    + begin_index + ", subset length:" + len);
        byte[] b = new byte[len];
        for (int i = 0; i < len; i++) {
            b[i] = a[i + begin_index];/*from w  w w.j  av  a2 s  .  c  o m*/
        }
        return b;
    }
}

Related

  1. subarrayChar2Double(char[] orig, int off, int len)
  2. subarrayEnd(byte[] array, int offset)
  3. subarrayEquals(int[] array, int[] subarray, int startIndex)
  4. subarrayOf(final String[] array, final int start, final int end)
  5. subset(boolean[] array, int start, int end)
  6. subset(byte[] array, int start, int length)
  7. subset(final char[] array, final int start, final int length)
  8. subset(int start, int count, byte[] source)
  9. subset(String[] array, int starting, int width)