Here you can find the source of bytesToString(byte[] bytes)
private static final String bytesToString(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { private static final String bytesToString(byte[] bytes) { StringBuffer encryptedUserID = new StringBuffer(); for (int i = 0; i < bytes.length; ++i) { String hex = Integer.toHexString(0xff & bytes[i]); if (hex.length() == 1) { encryptedUserID.append('0'); }/*w w w. java 2s .co m*/ encryptedUserID.append(hex); } return encryptedUserID.toString(); } }