Android Array Add append(byte[] data, byte[] adata)

Here you can find the source of append(byte[] data, byte[] adata)

Description

append

Declaration

public static byte[] append(byte[] data, byte[] adata) 

Method Source Code

//package com.java2s;

public class Main {

    public static byte[] append(byte[] data, byte[] adata) {
        if (data == null) {
            data = new byte[0];
        }/*from  w w  w.  java 2s  .  co m*/
        int len = data.length;
        if (adata == null) {
            return data;
        }
        int alen = adata.length;

        byte[] result = new byte[(len + alen)];

        for (int i = 0, j = 0; i < len + alen; i++) {
            if (i < len) {
                result[i] = data[i];
                continue;
            }
            result[i] = adata[j];
            j++;
        }

        return result;

    }
}

Related

  1. arrayappend(T[] array, T[] append, int size)
  2. arraybyteappend(byte[] array, byte[] append)
  3. arraybyteappend(byte[] array, byte[] append, int size)
  4. arrayintappend(int[] array, int[] append)
  5. arrayintappend(int[] array, int[] append, int size)