concatenate two byte arrays
来源:互联网 发布:硕士双录取 知乎 编辑:程序博客网 时间:2024/06/10 00:58
public static byte[] ConcatArrays(byte[] first, byte[]... rest) { int totalLength = first.length; for (byte[] array : rest) { totalLength += array.length; } byte[] result = Arrays.copyOf(first, totalLength); int offset = first.length; for (byte[] array : rest) { System.arraycopy(array, 0, result, offset, array.length); offset += array.length; } return result;}
这里利用Arrays.copyOf() 和 System.arraycopy()
public static void arraycopy (Object src, int srcPos, Object dst, int dstPos, int length)
The source and destination arrays can be the same array, in which case copying is performed as if the source elements are first copied into a temporary array and then into the destination array.
这段的大概意思是,src和dst可以是同一个数组对象。
0 0
- concatenate two byte arrays
- How to concatenate two matrices in Python?
- concatenate
- concatenate
- Two-dimensional arrays as arrays of arrays
- Merging two sorted arrays
- Bonfire: Diff Two Arrays
- Intersection of Two Arrays
- sky_Intersection of Two Arrays
- Intersection of Two Arrays
- Intersection of Two Arrays
- Intersection of Two Arrays
- Intersection of Two Arrays
- Intersection of Two Arrays
- Intersection of Two Arrays
- Intersection of Two Arrays
- Intersection of Two Arrays
- Intersection of Two Arrays
- informatica 创建存储库(Repository Service)和集成服务(Integration Service)
- Win7 X64安装SQLServer2008异常
- bower install js使用bower管理js
- 我的CUDA学习笔记
- 【C语言】将字符串顺序翻转,如: I am a student 转成:student a am I
- concatenate two byte arrays
- C语言实现 编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数。
- 函数调用栈空间的分配和释放
- UITableView上拉、下拉原理
- Oracle 中,函数如何返回结果集
- 蓝桥杯:算法训练 2的次幂表示
- ARM-Linux支持并自动挂载U盘
- convert a hexadecimal string to a byte string
- html5