Here you can find the source of bytes2HexString(byte[] src)
public static String bytes2HexString(byte[] src)
//package com.java2s; //License from project: Apache License public class Main { public static String bytes2HexString(byte[] src) { StringBuilder stringBuilder = new StringBuilder(""); if (null != src && src.length > 0) { for (int i = 0; i < src.length; i++) { int j = src[i] & 0xFF; String str = Integer.toHexString(j); if (str.length() < 2) { stringBuilder.append(0); }//from ww w . j ava 2 s .c om stringBuilder.append(str); } return stringBuilder.toString(); } return null; } }