Java tutorial
//package com.java2s; public class Main { public static String paddedByteString(byte b) { return Integer.toHexString((b | 256) & 511).toUpperCase().substring(1); } }