public abstract class FormatUtil extends Object
| Constructor and Description |
|---|
FormatUtil() |
| 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 |
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.
|
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 integerCopyright © 2010–2016 com.github.dblock. All rights reserved.