Java Utililty Methods Float Number Create

List of utility methods to do Float Number Create

Description

The list of methods to do Float Number Create are organized into topic(s).

Method

FloattoFloat(final String value)
create Long from str.
return Float.parseFloat(value);
floattoFloat(Float num, float defaultValue)
to Float
if (num == null) {
    return defaultValue;
} else {
    return num.floatValue();
floattoFloat(int colorComponent)
to Float
return colorComponent / 255.0f;
floattoFloat(int hbits)
to Float
int mant = hbits & 0x03ff; 
int exp = hbits & 0x7c00; 
if (exp == 0x7c00) 
    exp = 0x3fc00; 
else if (exp != 0) 
    exp += 0x1c000; 
    if (mant == 0 && exp > 0x1c400) 
...
floattoFloat(int majorVersion, int minorVersion)
to Float
return Float.parseFloat(majorVersion + "." + minorVersion);
doubletoFloat(int value)
to Float
return value / 100_000.0;
floattoFloat(int x)
to Float
return (float) x / ONE_FIXED;
float[]toFloat(int[] array)
1-D Integer array to float array.
float[] n = new float[array.length];
for (int i = 0; i < array.length; i++) {
    n[i] = (float) array[i];
return n;
FloattoFloat(long intPart, long decimalPart, long decimalPlaces)
to Float
if (intPart < 0 || decimalPart < 0 || decimalPlaces < 0)
    return null;
if (decimalPart == 0 || decimalPlaces == 0) {
    return Float.valueOf(intPart);
float divisor = (float) Math.pow(10, decimalPlaces);
return Float.valueOf(((float) intPart) + (((float) decimalPart) / divisor));
FloattoFloat(Number value)
to Float
if (value == null) {
    return null;
} else if (value instanceof Float) {
    return (Float) value;
} else {
    return Float.valueOf(value.floatValue());