Android Utililty Methods Byte Array Copy

List of utility methods to do Byte Array Copy

Description

The list of methods to do Byte Array Copy are organized into topic(s).

Method

byte[]copy(byte[] from)
Create a copy of the given array - or return null if the argument is null.
if (from != null) {
    byte[] to = new byte[from.length];
    System.arraycopy(from, 0, to, 0, to.length);
    return to;
return null;
byte[]copy(byte[] rSource)
copy
byte[] aResult = new byte[rSource.length];
System.arraycopy(rSource, 0, aResult, 0, aResult.length);
return aResult;
byte[]copy(byte[] source, byte[] target)
Copy the contents of the source array to the target array.
int len = source.length;
if (len > target.length) {
    target = new byte[len];
System.arraycopy(source, 0, target, 0, len);
return target;
byte[]copyByteArray(byte[] source)
copy Byte Array
byte[] buf = new byte[source.length];
System.arraycopy(source, 0, buf, 0, buf.length);
return buf;
byte[]getCopyByteArray(byte[] src, int start, int length)
get Copy Byte Array
byte[] dest = new byte[length];
System.arraycopy(src, start, dest, 0, length);
return dest;
byte[][]getCopyByteArrayArray(byte[] src, int start, int length, int subArrayLength)
new byte[] { 8, 4, 2, 1 }, 0, 4, 2 => new byte[][]{{8,4}, {2,1}}
byte[][] dest = new byte[length / subArrayLength][subArrayLength];
byte[] temp = new byte[length];
System.arraycopy(src, start, temp, 0, length);
for (int i = 0; i < dest.length; i++) {
    System.arraycopy(temp, i * subArrayLength, dest[i], 0,
            subArrayLength);
return dest;
...