I need to traverse through the bytearray and create an object for it. I have collection of objects/classes with member variables and their set and get methods.The fields in the objects correspond to one or multiple bytes in the byte array.Is there an elegant way to convert this byte array into object? Walking through the byte array seems a basic thought but ugly. Particularily when the byte array changes the code will have to change. The first byte in the bytearray indicates object identifier. Does Java reflection promises solution here? However I have heard reflection is slow and I might not tend to use it.