Here you can find the source of intToHex(int val)
public static String intToHex(int val)
//package com.java2s; //License from project: Open Source License public class Main { /**/* ww w . j av a2 s . co m*/ * Converts an int to a hex String. */ public static String intToHex(int val) { String hex = Integer.toHexString(val); if (hex.length() >= 8) { return hex.substring(hex.length() - 8); } return String.format("%8s", hex).replace(' ', '0'); } }