Here you can find the source of byteToString(byte[] bByte)
private static String byteToString(byte[] bByte)
//package com.java2s; //License from project: Apache License public class Main { /** global array **/ private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; private static String byteToString(byte[] bByte) { int k = 0; int len = bByte.length; char[] myChar = new char[len * 2]; for (byte b : bByte) { myChar[k++] = HEX_DIGITS[b >>> 4 & 0x0f]; myChar[k++] = HEX_DIGITS[b & 0x0f]; }//from ww w . ja va 2s. c o m return new String(myChar); } }