Here you can find the source of bytesToString(byte[] data, int start, int end)
public static String bytesToString(byte[] data, int start, int end)
//package com.java2s; // Licensed to the Apache Software Foundation (ASF) under one public class Main { /**//from ww w. ja v a 2 s . c o m * Converts a byte array to a hex readable string. **/ public static String bytesToString(byte[] data, int start, int end) { StringBuilder buf = new StringBuilder(); if (end > data.length) { end = data.length; } for (int i = start; i < end; i++) { buf.append(" "); buf.append(Integer.toHexString(data[i] & 0xff)); } return buf.toString(); } }