### Question:
ObjectId implements Bson, Comparable<ObjectId> { public String getHexData() { StringBuilder sb = new StringBuilder(); for (byte b : data) { sb.append(String.format("%02x", b)); } return sb.toString(); } ObjectId();  ObjectId(String hexString);  ObjectId(byte[] data); byte[] toByteArray(); @Override int compareTo(final ObjectId other); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); String getHexData();  }### Answer:
@Test void testToHexStringAndBack() throws Exception { ObjectId objectId = new ObjectId(); ObjectId clone = new ObjectId(objectId.getHexData()); assertThat(clone).isEqualTo(objectId); }