DigestUtilities { public static final String byteDigestToHexString(byte[] digest) { BigInteger bi = new BigInteger(1, digest); return String.format("%0" + (digest.length << 1) + "x", bi); } private  DigestUtilities(); static final String byteDigestToHexString(byte[] digest); static byte[] hexStringToByteArray(String hexVal); static Set<String> getMessageDigestAlgorithmNames();  }
@Test public void testByteDigestToHexString() throws URISyntaxException, FileNotFoundException, IOException { boolean dataTested = false; for (File file : AllCoreTest.getFilesFromResourceDir(AllCoreTest.TEST_DATA_ROOT)) { String apacheHex = DigestUtils.md5Hex(new FileInputStream(file)); String testHexVal = DigestUtilities.byteDigestToHexString(DigestUtils.md5(new FileInputStream(file))); assertEquals("apacheHex and testHextVal should be equal", apacheHex, testHexVal); dataTested = true; } assertTrue("No data tested as flag no set", dataTested); }