### Question:
ByteUtil { public static byte[] toBytes(char[] chars) { final CharBuffer charBuffer = CharBuffer.wrap(chars); final ByteBuffer byteBuffer = Charset.forName("UTF-8").encode(charBuffer); final byte[] bytes = Arrays.copyOfRange(byteBuffer.array(), byteBuffer.position(), byteBuffer.limit()); Arrays.fill(charBuffer.array(), '\u0000'); Arrays.fill(byteBuffer.array(), (byte) 0); return bytes; } private  ByteUtil(); static byte[] toBytes(char[] chars);  }### Answer:
@Test public void toBytesTest() { char[] chars={'a', 'b', 'c', 'd'}; Assert.assertNotNull(ByteUtil.toBytes(chars)); }