Java tutorial
//package com.java2s; //PduUtils is distributed under the terms of the Apache License version 2.0 public class Main { public static String bytesToPdu(byte[] bytes) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { sb.append(byteToPdu(bytes[i] & 0xFF)); } return sb.toString(); } public static String byteToPdu(int b) { StringBuffer sb = new StringBuffer(); String s = Integer.toHexString(b & 0xFF); if (s.length() == 1) { sb.append("0"); } sb.append(s); return sb.toString().toUpperCase(); } }