Here you can find the source of dumpBytes(byte[] byts, int offset, int length)
Parameter | Description |
---|---|
byts | bytes |
offset | starting position |
length | number of bytes |
public static String dumpBytes(byte[] byts, int offset, int length)
//package com.java2s; public class Main { private static String s_hexChars = "0123456789abcdef"; /**/*from w ww. j ava2s. co m*/ * Get printable representation of bytes in array. * * @param byts bytes * @param offset starting position * @param length number of bytes * @return text printable representationt */ public static String dumpBytes(byte[] byts, int offset, int length) { StringBuffer buff = new StringBuffer(length * 3); for (int i = 0; i < length; i++) { buff.append(' '); byte byt = byts[offset + i]; buff.append(s_hexChars.charAt((byt >> 4) & 0xF)); buff.append(s_hexChars.charAt(byt & 0xF)); } return buff.toString(); } }