### Question:
ObjectId implements Comparable<ObjectId>, Serializable { public static byte[] toRaw(final @NonNull String hash) { for (int i = 0; i < hash.length(); i++) { char c = hash.charAt(i); if (-1 == Character.digit(c, 16)) { throw new IllegalArgumentException("At index " + i + ": partialId is not a valid hash subsequence '" + hash + "'"); } } final byte[] raw = new byte[hash.length() / 2]; final int radix = 16; for (int i = 0; i < raw.length; i++) { raw[i] = (byte) Integer.parseInt(hash.substring(2 * i, 2 * i + 2), radix); } return raw; } ObjectId(byte[] raw); private  ObjectId(int h1, long h2, long h3); static ObjectId create(byte[] raw); static ObjectId create(int h1, long h2, long h3); boolean isNull(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static ObjectId valueOf(final @NonNull String hash); static byte[] toRaw(final @NonNull String hash); int compareTo(final ObjectId o); byte[] getRawValue(); void getRawValue(byte[] target); void getRawValue(byte[] target, final int length); int byteN(final int index); static ObjectId readFrom(DataInput in); void writeTo(DataOutput out); static final Ordering<ObjectId> NATURAL_ORDER; static final ObjectId NULL; static final HashFunction HASH_FUNCTION; static final int NUM_BYTES; }### Answer:
@Test public void testToRaw() { byte bytes[] = new byte[] { (byte) 0xff, (byte) 0x68, (byte) 0xb7, (byte) 0x47, (byte) 0x66, (byte) 0xe2, (byte) 0x0c, (byte) 0xca }; byte bytes2[] = ObjectId.toRaw("ff68b74766e20cca"); assertTrue(Arrays.equals(bytes, bytes2)); boolean caughtException = false; try { ObjectId.toRaw("r"); } catch (IllegalArgumentException e) { caughtException = true; } assertTrue(caughtException); }