Here you can find the source of toHex(int v)
static String toHex(int v)
//package com.java2s; //License from project: Apache License public class Main { static String toHex(int v) { v = Math.min(Math.max(v, 0), 255); return String.valueOf("0123456789abcdef".charAt(((v - v % 16) / 16))) + //$NON-NLS-1$ String.valueOf("0123456789abcdef".charAt(v % 16)); //$NON-NLS-1$ }//w ww . j a v a 2s . c o m }