Here you can find the source of intToHexString(int val, int width)
public static String intToHexString(int val, int width)
//package com.java2s; //License from project: Open Source License public class Main { static String mZeroes = "00000000000000000000000000000000"; public static String intToHexString(int val, int width) { String str = Integer.toHexString(val); if (str.length() >= width) { return str; }/*www . jav a 2 s .com*/ return mZeroes.substring(0, width - str.length()) + str; } }