title: Convert object to byte array and viceversa without serialization
body: <p>I have a java project in which I have to save the data of each run for later use. The professor wants us to use a RandomAccessFile to do this so I have to convert the objects to bytes so they can be stored in the RAF. The major problem is that if we use Serializable he'll deduct points,so my question is:</p>
  
  <p>Is there a way to convert object to byte array and viceversa without serialization?</p>
  
  <p>I don't want a full code just an approach to on how to do it is appreciated.</p>
  
  <p>EDIT:</p>
  
  <p>Thank you all for the advice, I ended up converting the objects fields to bytes and writing that to the RAF.</p>