How do I append the 开发者_如何学运维elements of a byte[]
to a List<Byte>
?
Is this what you're looking for?
for(byte b : byte) {
list.add(b);
}
Using Guava, you could use Bytes.asList(byte...) like this:
List<Byte> list = ...
byte[] bytes = ...
list.addAll(Bytes.asList(bytes));
精彩评论