i had a difficulty in converting an arraylist into a byte array and again retrive it into an arraylist again.
The Collections API has methods to convert between ArrayList and an array of Object references. However, a byte is NOT and array of object references, it is a single object that can hold an array of byte primitive values.
You will have to write code to iterate through the ArrayList or byte, converting values one at a time between object and primitive.
Jim Yingst wrote:If the objects in the list are Serializable, you can user an ObjectOutputStream plus a ByteArrayOutputStream to create the array, and an ObjectInputStream plus a ByteArrayInputStream to recreate the list (creating copies of all the contents, most likely, unless the class of the objects is written to prevent that). Is that what you're trying to do?
can you please give one small example by using ObjectOutputStream plus ByteArrayOutputStream to convert arraylist to byte array