### Question:
IDUtil { public synchronized static byte[] pseudoUniqueByteSequence(int length) { if (length < 16) { throw new IllegalArgumentException( "Can't generate unique byte sequence shorter than 16 bytes: " + length); } if (length == 16) { return pseudoUniqueByteSequence16(); } byte[] bytes = new byte[length]; for (int i = 0; i <= length - 16; i += 16) { byte[] nextSequence = pseudoUniqueByteSequence16(); System.arraycopy(nextSequence, 0, bytes, i, 16); } int leftoverLen = length % 16; if (leftoverLen > 0) { byte[] nextSequence = pseudoUniqueByteSequence16(); System.arraycopy(nextSequence, 0, bytes, length - leftoverLen, leftoverLen); } return bytes; } private  IDUtil(); static void appendFormattedByte(Appendable buffer, byte byteValue); synchronized static byte[] pseudoUniqueByteSequence(int length); synchronized static byte[] pseudoUniqueSecureByteSequence(int length); static final byte[] pseudoUniqueByteSequence8(); static final byte[] pseudoUniqueByteSequence16(); static byte[] pseudoUniqueSecureByteSequence16();  }### Answer:
@Test public void testPseudoUniqueByteSequence1() throws Exception { try { IDUtil.pseudoUniqueByteSequence(10); fail("must throw an exception on short sequences"); } catch (IllegalArgumentException ex) { } }
@Test public void testPseudoUniqueByteSequence2() throws Exception { byte[] byte16 = IDUtil.pseudoUniqueByteSequence(16); assertNotNull(byte16); assertEquals(16, byte16.length); try { ByteArrayTypeTest.assertByteArraysEqual( byte16, IDUtil.pseudoUniqueByteSequence(16)); fail("Same byte array.."); } catch (Throwable th) { } }
@Test public void testPseudoUniqueByteSequence3() throws Exception { byte[] byte17 = IDUtil.pseudoUniqueByteSequence(17); assertNotNull(byte17); assertEquals(17, byte17.length); byte[] byte123 = IDUtil.pseudoUniqueByteSequence(123); assertNotNull(byte123); assertEquals(123, byte123.length); }