Java Array Slice slice(byte[] source, int start, int end)

Here you can find the source of slice(byte[] source, int start, int end)

Description

slice

License

Open Source License

Declaration

public static byte[] slice(byte[] source, int start, int end) 

Method Source Code

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

public class Main {

    public static byte[] slice(byte[] source, int start, int end) {
        if (start < 0 || end > source.length) {
            throw new IllegalArgumentException("start or end is out of bound");
        }//from   w  w  w . j a  v  a 2 s .  c  o m
        byte[] target = new byte[end - start];
        System.arraycopy(source, start, target, 0, target.length);
        return target;
    }
}

Related

  1. arraySlice(int[] source, int start, int count)
  2. arraySlice(Object[] source, Object[] dest, int startIdx)
  3. slice(byte[] buffer, int start, int end)
  4. slice(Object[] objects, int begin, int length)
  5. slice(String source[], int start, int end)
  6. slice(String[] array, int a, int b)
  7. slice(String[] array, int index, int length)