Java tutorial
//package com.java2s; public class Main { public static String byteArrayToHexString(byte[] b, int start, int stop) { String stmp = ""; StringBuilder sb = new StringBuilder(""); for (int n = start; n <= stop; n++) { stmp = Integer.toHexString(b[n] & 0xFF); sb.append((stmp.length() == 1) ? "0" + stmp : stmp); //sb.append(" "); } System.out.println("deviceinfo :" + sb); return sb.toString().toUpperCase().trim(); } }