Here you can find the source of intToHexChars(int n)
private static char[] intToHexChars(int n)
//package com.java2s; /**// w w w . ja va2s .c o m * Copyright 2001-2014 CryptoHeaven Corp. All Rights Reserved. * * This software is the confidential and proprietary information * of CryptoHeaven Corp. ("Confidential Information"). You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with CryptoHeaven Corp. */ public class Main { /** data for hexadecimal visualisation. */ private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; /** * Returns a string of 8 hexadecimal digits (most significant * digit first) corresponding to the integer <i>n</i>, which is * treated as unsigned. */ private static char[] intToHexChars(int n) { char[] buf = new char[8]; for (int i = 7; i >= 0; i--) { buf[i] = HEX_DIGITS[n & 0x0F]; n >>>= 4; } return buf; } }