Here you can find the source of makeHex(int val)
public static String makeHex(int val)
//package com.java2s; public class Main { public static String makeHex(int val) { String ret = ""; String[] hexChars = new String[16]; for (int i = 0; i < 10; i++) { hexChars[i] = String.valueOf(i); }//from ww w.ja va 2 s . com hexChars[10] = "A"; hexChars[11] = "B"; hexChars[12] = "C"; hexChars[13] = "D"; hexChars[14] = "E"; hexChars[15] = "F"; int main, remain; while (val > 0) { main = val / 16; remain = val % 16; ret = hexChars[remain] + ret; val = main; } return ret; } }