Here you can find the source of bytesToHexString(byte abyte0[])
public static String bytesToHexString(byte abyte0[])
//package com.java2s; public class Main { public static String bytesToHexString(byte abyte0[]) { StringBuilder stringbuilder = new StringBuilder(""); if (abyte0 == null || abyte0.length <= 0) return null; for (int i = 0; i < abyte0.length; i++) { int j = abyte0[i] & 0xff; String s = Integer.toHexString(j); if (s.length() < 2) stringbuilder.append(0); stringbuilder.append(s);//from ww w .j a v a 2 s. c o m } return stringbuilder.toString(); } }