### Question:
ByteArrayUtils { public static String toHex(byte[] byteArray) { if (byteArray == null) { return ""; } StringBuilder hexStringBuilder = new StringBuilder(); for (int i = 0; i < byteArray.length; i++) { hexStringBuilder.append(byteToHex[byteArray[i] & 0xFF]); } return hexStringBuilder.toString(); }  static byte[] fromHex(String hex); static String toHex(byte[] byteArray); static int threeBytesToInt(byte[] bytes, int offset);  }### Answer:
@Test public void toHex_null() { String hex = ByteArrayUtils.toHex(null); assertEquals(hex.length(), 0); }
@Test public void toHex_empty() { byte[] bytes = new byte[0]; String hex = ByteArrayUtils.toHex(bytes); assertEquals(hex.length(), 0); }
@Test public void toHex_bytearray_good() { String hex = ByteArrayUtils.toHex(BYTEARRAY_GOOD); assertEquals(hex, HEXSTRING_GOOD); }