Package com.tom_roush.pdfbox.util
Class NumberFormatUtil
- java.lang.Object
-
- com.tom_roush.pdfbox.util.NumberFormatUtil
-
public class NumberFormatUtil extends Object
This class contains methods to format numbers.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intformatFloatFast(float value, int maxFractionDigits, byte[] asciiBuffer)Fast variant to format a floating point value to a ASCII-string.
-
-
-
Method Detail
-
formatFloatFast
public static int formatFloatFast(float value, int maxFractionDigits, byte[] asciiBuffer)Fast variant to format a floating point value to a ASCII-string. The format will fail if the value is greater thanLong.MAX_VALUE, smaller or equal toLong.MIN_VALUE, isFloat.NaN, infinite or the number of requested fraction digits is greater thanMAX_FRACTION_DIGITS. When the number contains more fractional digits thanmaxFractionDigitsthe value will be rounded. Rounding is done to the nearest possible value, with the tie breaking rule of rounding away from zero.- Parameters:
value- The float value to formatmaxFractionDigits- The maximum number of fraction digits usedasciiBuffer- The output buffer to write the formatted value to- Returns:
- The number of bytes used in the buffer or
-1if formatting failed
-
-