Here you can find the source of concatByteArray(byte[] a, byte[] b)
Parameter | Description |
---|---|
number | The int value to be converted. |
public static byte[] concatByteArray(byte[] a, byte[] b)
//package com.java2s; public class Main { /**/* ww w . j a v a 2 s . c o m*/ * * Method Concatenates the specified byte[]. * * @param number The int value to be converted. * */ public static byte[] concatByteArray(byte[] a, byte[] b) { int aL = a.length; int bL = b.length; int len = aL + bL; byte[] c = new byte[len]; System.arraycopy(a, 0, c, 0, aL); System.arraycopy(b, 0, c, aL, bL); return c; } public static void arraycopy(String src, int srcOffset, byte[] dst, int dstOffset, int length) { if (src == null || dst == null) { throw new NullPointerException("invalid byte array "); } if ((src.length() < (srcOffset + length)) || (dst.length < (dstOffset + length))) { throw new IndexOutOfBoundsException("invalid length: " + length); } for (int i = 0; i < length; i++) { dst[dstOffset + i] = (byte) src.charAt(srcOffset + i); } } }