Here you can find the source of toHexString(int i)
private static String toHexString(int i)
//package com.java2s; /*/* ww w . j a v a2 s . co m*/ * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ public class Main { /** * Convert an integer to a 16-digit hex string. */ private static String toHexString(int i) { String s = Integer.toHexString(i).toUpperCase(); if (s.length() < 8) return "00000000".substring(8 - s.length()) + s; else return s; } /** * Convert a long to a 16-digit hex string. */ private static String toHexString(long l) { String s = Long.toHexString(l).toUpperCase(); if (s.length() < 16) return "0000000000000000".substring(16 - s.length()) + s; else return s; } }