Java Byte Array Copy copyByte(byte[] ASource, int nFrom, int nEnd)

Here you can find the source of copyByte(byte[] ASource, int nFrom, int nEnd)

Description

copy Byte

License

Apache License

Declaration

public static byte[] copyByte(byte[] ASource, int nFrom, int nEnd) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static byte[] copyByte(byte[] ASource, int nFrom, int nEnd) {
        if (nEnd < nFrom) {
            return null;
        }/*ww  w.j a  v a2  s .  c o  m*/
        if (nEnd >= ASource.length) {
            nEnd = ASource.length - 1;
        }
        int j = 0;
        byte[] sResult = new byte[nEnd - nFrom + 1];
        for (int i = nFrom; i <= nEnd; i++) {
            sResult[j] = ASource[i];
            j = j + 1;
        }
        return sResult;
    }
}

Related

  1. copyByteArray(byte[] array2Copy)
  2. copyByteArray(byte[] source)
  3. copyByteArray(final byte[] src, byte[] dest, int length)
  4. copyBytes(byte[] arr, int length)