Here you can find the source of toHex(long value, int length)
Parameter | Description |
---|---|
value | The long value |
length | The length of the string |
public static String toHex(long value, int length)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w. j av a2 s. c o m * Converts a long value to an HEX string.<br> * * @param value * The long value * @param length * The length of the string * @return The hex string */ public static String toHex(long value, int length) { return String.format("%0" + length + "X", value); } /** * Converts an float value to an HEX string.<br> * * @param value * The float value * @param length * The length of the string * @return The hex string */ public static String toHex(float value, int length) { return toHex(convertFloatToHex(value), length); } /** * Convert a float value to a hex value given as a long.<br> * * @param floatValue * The float value * @return The hex value */ public static long convertFloatToHex(float floatValue) { return Float.floatToIntBits(floatValue) & 0xFFFFFFFFL; } }