public class FormatUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
HEX_ERROR
Constant
HEX_ERROR="0x%08X" |
| Modifier and Type | Method and Description |
|---|---|
static String |
formatBytes(long bytes)
Format bytes into a rounded string representation using IEC standard (matches
Mac/Linux).
|
static String |
formatBytesDecimal(long bytes)
Format bytes into a rounded string representation using decimal SI units.
|
static String |
formatElapsedSecs(long secs)
Formats an elapsed time in seconds as days, hh:mm:ss.
|
static String |
formatError(int errorCode)
Translate an integer error code to its hex notation
|
static String |
formatHertz(long hertz)
Format hertz into a string to a rounded string representation.
|
static String |
formatValue(long value,
String unit)
Format arbitrary units into a string to a rounded string representation.
|
static long |
getUnsignedInt(int x)
Convert unsigned int to signed long.
|
static float |
round(float d,
int decimalPlace)
Round to certain number of decimals.
|
static String |
toUnsignedString(int i)
Represent a 32 bit value as if it were an unsigned integer.
|
static String |
toUnsignedString(long l)
Represent a 64 bit value as if it were an unsigned long.
|
public static final String HEX_ERROR
HEX_ERROR="0x%08X"public static String formatBytes(long bytes)
formatBytesDecimal(long). For Windows displays for KB, MB and GB, in
JEDEC units, edit the returned string to remove the 'i' to display the
(incorrect) JEDEC units.bytes - Bytes.public static String formatBytesDecimal(long bytes)
formatBytes(long).bytes - Bytes.public static String formatHertz(long hertz)
hertz - Hertz.public static String formatValue(long value, String unit)
value - The valueunit - Units to append metric prefix topublic static String formatElapsedSecs(long secs)
secs - Elapsed secondspublic static float round(float d,
int decimalPlace)
d - Number to be roundeddecimalPlace - Number of decimal places to round topublic static long getUnsignedInt(int x)
x - Signed int representing an unsigned integerpublic static String toUnsignedString(int i)
i - a 32 bit valuepublic static String toUnsignedString(long l)
l - a 64 bit valuepublic static String formatError(int errorCode)
errorCode - The error codeCopyright © 2010–2020 oshi. All rights reserved.