Here you can find the source of bytes2String(byte[] buffer, int offset, int length)
public static String bytes2String(byte[] buffer, int offset, int length)
//package com.java2s; //License from project: Apache License public class Main { public static String bytes2String(byte[] buffer, int offset, int length) { StringBuilder sb = new StringBuilder(); for (int i = offset; i < offset + length; i++) { byte b = buffer[i]; sb.append(String.format("%02X", b)); sb.append(" "); }//from www . ja v a2 s . co m return sb.toString(); } }