Here you can find the source of intToHexWithPadding(Integer input, Integer max_size)
public static String intToHexWithPadding(Integer input, Integer max_size)
//package com.java2s; //License from project: Open Source License public class Main { public static String intToHexWithPadding(Integer input, Integer max_size) { if (max_size <= 8) { return String.format("%02x", input); } else if (max_size <= 16) { return String.format("%04x", input); } else {/*from ww w.ja v a 2 s . com*/ return String.format("%08x", input); } } }