code: public static String toHex(final byte[] bytes, final int offset, final int count) {
          if(offset >= bytes.length) throw new IllegalArgumentException("Offset is greater than the length (" + offset + " >= " + bytes.length + ").")/*by contract*/;
          final int byteCount = Math.min( (bytes.length - offset), count);
          final int upperBound = byteCount + offset;
  
          final char[] chars = new char[byteCount * 2/*two chars per byte*/];
          int charIndex = 0;
          for(int i=offset; i<upperBound; i++) {
              final byte value = bytes[i];
              chars[charIndex++] = HEX[(value >>> 4) & 0x0F];
              chars[charIndex++] = HEX[value & 0x0F];
          }
  
          return new String(chars);
      }
docs: Converts the specified array of <code>byte</code>s into a string of
  hex characters (low <code>byte</code> first).
  
  @param  bytes the array of <code>byte</code>s that are to be converted.
  This cannot be <code>null</code> though it may be empty.
  @param  offset the offset in <code>bytes</code> at which the bytes will
  be taken.  This cannot be negative and must be less than
  <code>bytes.length - 1</code>.
  @param  count the number of bytes to be retrieved from the specified array.
  This cannot be negative.  If greater than <code>bytes.length - offset</code>
  then that value is used.
  @return a string of at most <code>count</code> characters that represents
  the specified byte array in hex.  This will never be <code>null</code>
  though it may be empty if <code>bytes</code> is empty or <code>count</code>
  is zero.
  @throws IllegalArgumentException if <code>offset</code> is greater than
  or equal to <code>bytes.length</code>.
  @see #fromHex(String, int, int)