public class NumberFormatUtil extends Object
Constructor and Description |
---|
NumberFormatUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
formatFloatFast(float value,
int maxFractionDigits,
byte[] asciiBuffer)
Fast variant to format a floating point value to a ASCII-string.
|
public static int formatFloatFast(float value, int maxFractionDigits, byte[] asciiBuffer)
Long.MAX_VALUE
, smaller or equal to Long.MIN_VALUE
, is
Float.NaN
, infinite or the number of requested fraction digits is greater than
MAX_FRACTION_DIGITS
.
When the number contains more fractional digits than maxFractionDigits
the value will
be rounded. Rounding is done to the nearest possible value, with the tie breaking rule of
rounding away from zero.value
- The float value to formatmaxFractionDigits
- The maximum number of fraction digits usedasciiBuffer
- The output buffer to write the formatted value to-1
if formatting failedCopyright © 2002–2017 The Apache Software Foundation. All rights reserved.