Here you can find the source of bytes2string(byte[] src)
public static String bytes2string(byte[] src)
//package com.java2s; //License from project: Apache License public class Main { final static char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); public static String bytes2string(byte[] src) { char[] hexChars = new char[src.length * 2]; for (int j = 0; j < src.length; j++) { int v = src[j] & 0xFF; hexChars[j * 2] = HEX_ARRAY[v >>> 4]; hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F]; }// w ww . ja va 2s. c om return new String(hexChars); } }