code: public static String toHexString(byte[] b) {
         StringBuffer result = new StringBuffer(b.length * 2);
         for (int i = 0; i < b.length; i++) {
            result.append(digits.charAt((b[i] >> 4) & 0xf));
            result.append(digits.charAt(b[i] & 0xf));
         }
         return (result.toString());
      }
docs: Converts a byte array to a hexadecimal string.