Here you can find the source of integerToHex(final Object value, final int desimals)
public static String integerToHex(final Object value, final int desimals)
//package com.java2s; // and/or modify it under the terms of the GNU General Public License public class Main { private static String zeroes = "00000000000000000000000000000000"; public static String integerToHex(final Object value, final int desimals) { String str = Long.toString(((Number) value).longValue(), 16).toUpperCase(); if (desimals == 0 || str.length() == zeroes.length()) { return str; }//from www . j a v a 2 s . c o m return zeroes.substring(0, desimals - str.length()) + str; } }