merge two Byte array - Android java.lang

Android examples for java.lang:Byte Array

Description

merge two Byte array

Demo Code

import android.content.Context;
import android.graphics.Paint;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static byte[] mergeByteData(byte[] src, byte[] obj) {
        if (src == null || src.length < 0)
            return obj;

        if (obj == null || obj.length < 0)
            return src;

        byte[] data = new byte[src.length + obj.length];
        System.arraycopy(src, 0, data, 0, src.length);
        System.arraycopy(obj, 0, data, src.length, obj.length);
        return data;
    }/*w  w w  .jav  a  2  s  .  co m*/

}

Related Tutorials