Here you can find the source of printHex(byte b)
private static void printHex(byte b)
//package com.java2s; /*/* www. j a v a 2 s . c om*/ * $RCSfile: FPXUtils.java,v $ * * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. * * Use is subject to license terms. * * $Revision: 1.1 $ * $Date: 2005/02/11 04:55:41 $ * $State: Exp $ */ public class Main { private static void printHex(byte b) { int i = b & 0xff; int hi = i / 16; int lo = i % 16; if (hi < 10) { System.out.print((char) ('0' + hi)); } else { System.out.print((char) ('a' + hi - 10)); } if (lo < 10) { System.out.print((char) ('0' + lo)); } else { System.out.print((char) ('a' + lo - 10)); } } }