Here you can find the source of dumpBytes(byte[] bytes)
public static String dumpBytes(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { protected final static char[] hexArray = "0123456789ABCDEF".toCharArray(); public static String dumpBytes(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int i = 0; i < bytes.length; i++) { int val = bytes[i] & 0xFF; hexChars[i * 2] = hexArray[val >>> 4]; hexChars[i * 2 + 1] = hexArray[val & 0x0F]; }// w w w.j a va 2 s. c o m return new String(hexChars); } }