Java tutorial
//package com.java2s; public class Main { public static String toString(byte b) { StringBuffer sb = new StringBuffer(2); int i = (b & 0xF0) >> 4; int j = b & 0x0F; sb.append(new Character((char) ((i > 9) ? (65 + i - 10) : (48 + i)))); sb.append(new Character((char) ((j > 9) ? (65 + j - 10) : (48 + j)))); return sb.toString(); } }