code: public String toHexString(int offset, int length) {
          // is offset, length valid for the current size() of our internal byte[]
          checkOffsetLength(size(), offset, length);
  
          // if length is 0, return an empty string
          if (length == 0 || size() == 0) {
              return "";
          }
  
          StringBuilder s = new StringBuilder(length * 2);
          int end = offset + length;
          for (int i = offset; i < end; i++) {
              HexUtil.appendHexString(s, getUnchecked(i));
          }
          
          return s.toString();
      }
docs: Return a hexidecimal String representation of the current buffer with each byte
  displayed in a 2 character hexidecimal format.  Useful for debugging.
  Convert a ByteBuffer to a String with a hexidecimal format.
  @param offset
  @param length
  @return The string in hex representation