class ObjHexStringConverter {

  public static String object2hex(Serializable obj) throws IOException {
    ByteArrayOutputStream bytesout = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bytesout);
    oos.writeObject(obj);
    oos.flush();
    String hexString = Hex.encodeHexString(bytesout.toByteArray());
    bytesout.close();
    oos.close();
    return hexString;
  }

}