Here you can find the source of dump(ByteBuffer buffer)
public static void dump(ByteBuffer buffer)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static void dump(ByteBuffer buffer) { System.out.println();//from w ww. j av a 2 s.co m int mark = buffer.position(); int ii = 0; while (buffer.hasRemaining()) { if ((ii & 15) == 0) System.out.printf("%04X: ", ii); System.out.printf("%02X ", buffer.get()); if ((ii & 15) == 15) System.out.println(); ii++; } buffer.position(mark); System.out.println(); } }