Here you can find the source of toHexString(byte[] messagePayload)
public static String toHexString(byte[] messagePayload)
//package com.java2s; //License from project: Open Source License public class Main { public static String toHexString(byte[] messagePayload) { String pystr = ""; for (byte b : messagePayload) { pystr = pystr + (Integer.toHexString(0xFF & b)) + " "; }/* w w w .j a v a 2 s.c om*/ return pystr.trim(); } }