Here you can find the source of bytes2String(byte[] bytes)
public static String bytes2String(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { public static String bytes2String(byte[] bytes) { StringBuilder string = new StringBuilder(); for (byte b : bytes) { String hexString = Integer.toHexString(0x00FF & b); string.append(hexString.length() == 1 ? "0" + hexString : hexString); }/* w ww .j a va2 s . c om*/ return string.toString(); } }