Here you can find the source of toHexString(byte buffer[])
private static String toHexString(byte buffer[])
//package com.java2s; //License from project: Open Source License public class Main { private static String toHexString(byte buffer[]) { StringBuilder content = new StringBuilder(buffer.length * 2); for (int i = 0; i < buffer.length; i++) { content.append(Character.forDigit((buffer[i] & 240) >> 4, 16)); content.append(Character.forDigit(buffer[i] & 15, 16)); }//www .ja v a2 s .c o m return content.toString(); } }