Here you can find the source of bytes_to_hex(byte[] b)
public static String bytes_to_hex(byte[] b)
//package com.java2s; //License from project: MIT License public class Main { public static String bytes_to_hex(byte[] b) { String result = ""; for (int i = 0; i < b.length; i++) { result += Integer.toString((b[i] & 0xff) + 0x100, 16) .substring(1);//from ww w . ja va 2 s . c o m } return result; } }