Here you can find the source of toHexString(int decimal, int stringLength)
Parameter | Description |
---|---|
decimal | A decimal value. |
stringLength | The length of the resulting string. |
private static String toHexString(int decimal, int stringLength)
//package com.java2s; //License from project: Open Source License public class Main { /**// ww w .j av a2s .com * Converts a decimal value to a hexadecimal string represention of the * specified length. For unicode escaping. * * @param decimal * A decimal value. * @param stringLength * The length of the resulting string. **/ private static String toHexString(int decimal, int stringLength) { return String.format("%0" + stringLength + "X", decimal); } }