code: private static byte[] serializeObject(Object obj) {
  
          if (obj == null) {
              return null;
          }
  
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          try {
              ObjectOutputStream out = new ObjectOutputStream(baos);
              out.writeObject(obj);
              out.flush();
          } catch (IOException ioex) {
              throw new EJBException("Timer info object failed to serialize.", ioex);
          }
  
          return baos.toByteArray();
      }
docs: Internal convenience method for serializing the user info object to a byte array.