What's the easiest way add all of the elements in an array to a list?
e.g.
List<Byte> l = new ArrayList<Byte>();
//Want to add each element in below array to l
byte[] b = "something".getBytes("UTF-8");
Is there some utility method or something that does this. I tried to use addAll, but that wants to add the actual array to the collection.
Thank you.
EDIT:
To clarify, I do want to do this with byte[] because I am going to eventually convert the list back to a byte[] and feed it into MessageDigest.update(). Does that help clarify?
EDIT 2:
So it seems like List<Byte>
is bad; very bad. What data structure would be recommended if I am basically adding arrays of bytes (I am making a hash of some some SALTS and user information) to feed into MessageDigest?