Here you can find the source of toHexString(byte[] byteArray, int offset, int size)
public static String toHexString(byte[] byteArray, int offset, int size)
//package com.java2s; //License from project: Open Source License public class Main { public static String toHexString(byte[] byteArray) { return toHexString(byteArray, 0, byteArray.length); }/*ww w. j a v a 2 s . c o m*/ public static String toHexString(byte[] byteArray, int offset, int size) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < size; i++) { if (i > 0) builder.append(' '); builder.append(String.format("%02X", byteArray[offset + i])); } return builder.toString(); } }