Here you can find the source of dump(byte[] mem, int start, int len)
public static final void dump(byte[] mem, int start, int len)
//package com.java2s; /* Cortado - a video player java applet * Copyright (C) 2004 Fluendo S.L./*from w w w . j a v a 2s.c o m*/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. */ public class Main { private static final char[] bytes = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; public static final void dump(byte[] mem, int start, int len) { int i, j; StringBuffer string = new StringBuffer(50); StringBuffer chars = new StringBuffer(18); String vis = new String(mem, start, len); i = j = 0; while (i < len) { int b = ((int) mem[i + start]); if (b < 0) b += 256; if (b > 0x20 && b < 0x7f) chars.append(vis.charAt(i)); else chars.append("."); string.append(bytes[b / 16]); string.append(bytes[b % 16]); string.append(" "); j++; i++; if (j == 16 || i == len) { System.out.println("" + (i - j) + " " + string.toString() + chars.toString()); string.setLength(0); chars.setLength(0); j = 0; } } } }