How to convert byte[] to Byte[] and the other way around?

byte[] to Byte[] :

byte[] bytes = ...;
Byte[] byteObject = ArrayUtils.toObject(bytes);

Byte[] to byte[] :

Byte[] byteObject = new Byte[0];
byte[] bytes = ArrayUtils.toPrimitive(byteObject);

Leave a Comment