Here you can find the source of toHexString(int b)
public static final String toHexString(int b)
//package com.java2s; public class Main { public static final String toHexString(int b) { return "" + toHexChar(b >> 4) + toHexChar(b); }//from w ww .j ava 2 s. co m public static final char toHexChar(int b) { switch (0XF & b) { case 0xF: return 'F'; case 0xE: return 'E'; case 0xD: return 'D'; case 0xC: return 'C'; case 0xB: return 'B'; case 0xA: return 'A'; default: return (char) ('0' + (0xF & b)); } } }