/** * Converts a byte array into a string of lower case hex chars. * * @param bs * A byte array * @param off * The index of the first byte to read * @param length * The number of bytes to read. * @return the string of hex chars. */ public static String bytesToHex(byte[] bs, int off, int length) { if (bs == null) { return null; } if (bs.length <= off || bs.length < off + length) { throw new IllegalArgumentException(); } StringBuilder sb = new StringBuilder(length * 2); bytesToHexAppend(bs, off, length, sb); return sb.toString(); }