public byte[] toByteArray(final Object object) throws IOException {
		final ByteArrayOutputStream out = new ByteArrayOutputStream();
		write(object, out);
		return out.toByteArray();
	}
Serializes the given {@code object} to a {@code byte[]} array.

@since 4.1

@param object the object to serialize.
@throws NullPointerException if one of the objects is {@code null}.
@throws IOException if the object could not be serialized.
@return the serialized {@code object} as {@code byte[]} array
jenetics/src/main/java/io/jenetics/util/IO.java