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(String value, float defaultValue)
convert the string to an float, and return the default value if the string is null or does not contain a valid int value
if (value != null) {
    try {
        return Float.parseFloat(value);
    } catch (NumberFormatException n) {
return defaultValue;
FloattoFloat(T value)
to Float
return (value != null ? value.floatValue() : null);
float[]toFloatA(byte[] data)
to Float A
if (data == null || data.length % 4 != 0)
    return null;
float[] flts = new float[data.length / 4];
for (int i = 0; i < flts.length; i++) {
    flts[i] = toFloat(
            new byte[] { data[(i * 4)], data[(i * 4) + 1], data[(i * 4) + 2], data[(i * 4) + 3], });
return flts;
...
FloattoFloatObject(Object o)
to Float Object
if (o == null) {
    return null;
Float num;
if (o instanceof Float) {
    num = (Float) o;
} else if (o instanceof Number) {
    num = Float.valueOf(((Number) o).floatValue());
...