Here you can find the source of bytes2string(byte[] src)
public static String bytes2string(byte[] src)
//package com.java2s; //License from project: Open Source License public class Main { public static String bytes2string(byte[] src) { StringBuilder sb = new StringBuilder(); if (src == null || src.length <= 0) { return null; }// www.j a v a 2 s . co m for (int i = 0; i < src.length; i++) { int v = src[i] & 0xFF; String hv = Integer.toHexString(v); if (hv.length() < 2) { sb.append(0); } sb.append(hv.toUpperCase()); } return sb.toString(); } }