转换 ArrayList<Byte>成一个字节[] [英] Convert ArrayList&lt;Byte&gt; into a byte[]

查看:34
本文介绍了转换 ArrayList<Byte>成一个字节[]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
如何将包含整数的 ArrayList 转换为原始整数数组?

如何将ArrayList转换成byte[]?

ArrayList.toArray() 返回一个 Byte[].

推荐答案

调用 toArray() 后可以将结果传递给 Apache Commons 的 toPrimitive 方法:

After calling toArray() you can pass the result into the Apache Commons toPrimitive method:

https://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/ArrayUtils.html#toPrimitive-java.lang.字节:A->

这篇关于转换 ArrayList<Byte>成一个字节[]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆