Java – Byte[] to byte[]

bytebytearrayjava

There is Vector and DataOutputStream. I need to write bytes from Vector (toArray returns Byte[]) to the stream, but it understands byte[] only. How to convert Byte[] to byte[] ?

Best Solution

You could use the toPrimitive method in the Apache Commons lang library ArrayUtils class?