code: public static void dumpHex(StringBuilder s, ByteBuffer buffer) {
  		int savePos = buffer.position();
  		int line = 0;
  		while (buffer.hasRemaining()) {
  			s.append(StringUtil.encodeHexaPadding(16L * line)).append(' ');
  			int l = buffer.remaining() >= 16 ? 16 : buffer.remaining();
  			byte[] b = new byte[l];
  			buffer.get(b);
  			for (int i = 0; i < 16; ++i) {
  				if (b.length <= i) s.append("   ");
  				else s.append(StringUtil.encodeHexa(b[i])).append(' ');
  			}
  			s.append("  ");
  			for (int i = 0; i < 16; ++i) {
  				if (b.length <= i) s.append(' ');
  				else {
  					char c = (char)(b[i] & 0xFF);
  					if (c < 0x20 || c > 0x7F) c = '.';
  					s.append(c);
  				}
  			}
  			s.append("\r\n");
  			line++;
  		}
  		buffer.position(savePos);
  	}
docs: Create an hexadecimal dump of the given buffer.