Here you can find the source of typeToHex(byte buffer[])
private static String typeToHex(byte buffer[])
//package com.java2s; //License from project: Open Source License public class Main { private static String typeToHex(byte buffer[]) { StringBuffer sb = new StringBuffer(buffer.length * 2); for (int i = 0; i < buffer.length; i++) { sb.append(Character.forDigit((buffer[i] & 240) >> 4, 16)); sb.append(Character.forDigit(buffer[i] & 15, 16)); }/* w w w . jav a 2 s. co m*/ return sb.toString(); } }