private static WorkingMemory serializeWorkingMemory(WorkingMemory workingMemoryIn) throws Exception
{
// Serialize to a byte array
ByteArrayOutputStream bos = new ByteArrayOutputStream( );
ObjectOutput out = new ObjectOutputStream( bos );
out.writeObject( workingMemoryIn );
out.close( );
// Get the bytes of the serialized object
byte[] bytes = bos.toByteArray( );
// Deserialize from a byte array