Android Utililty Methods Byte Array Sub Array Get

List of utility methods to do Byte Array Sub Array Get

Description

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

Method

byte[]getBytes(byte[] data, int offset, int len)
get Bytes
byte[] tmp = new byte[len];
for (int i = 0; i < len; i++) {
    tmp[i] = data[offset + i];
return tmp;
byte[]subByte(byte[] data, int start)
sub Byte
int len = data.length;
if (start >= len) {
    return null;
if (start < 0) {
    start = len + start;
    if (start < 0) {
        return null;
...
byte[]subByte(byte[] data, int start, int end)
sub Byte
int len = data.length;
if (start >= len || end <= start || end < 1) {
    return null;
byte[] result = new byte[(end - start)];
for (int i = start, j = 0; i < len; i++, j++) {
    if (i < end) {
        result[j] = data[i];
...
byte[]subarray(byte[] in, int a, int b)
Creates and returns a new array with the values of the original from index a to index b and of size (b-a).
if (b - a > in.length)
    return in;
byte[] out = new byte[(b - a) + 1];
for (int i = a; i <= b; i++) {
    out[i - a] = in[i];
return out;