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(Object _inStrObj)
to Float
if (_inStrObj == null || _inStrObj.toString().trim().equals("")) {
    return 0;
} else {
    return Float.valueOf(_inStrObj.toString()).floatValue();
FloattoFloat(Object anObj)
Converts given value to Float.
if (anObj == null)
    return null;
Float tmpResult = null;
if (anObj instanceof Float) {
    tmpResult = (Float) anObj;
} else if (anObj instanceof Number) {
    tmpResult = new Float(((Number) anObj).floatValue());
} else {
...
FloattoFloat(Object literal)
to Float
if (literal instanceof Number) {
    return ((Number) literal).floatValue();
if (literal instanceof String) {
    try {
        return Float.valueOf((String) literal);
    } catch (NumberFormatException e) {
return null;
FloattoFloat(Object o)
to Float
if (o == null)
    return null;
if (o.getClass() == Float.class)
    return (Float) o;
if (o.getClass() == Boolean.class)
    return booleanToFloat((Boolean) o);
if (o.getClass() == Byte.class)
    return (float) ((Byte) o).byteValue();
...
FloattoFloat(Object o)
to Float
Float f;
if (o instanceof Float) {
    f = (Float) o;
} else {
    try {
        f = Float.valueOf(o.toString());
    } catch (Exception e) {
        f = null;
...
FloattoFloat(Object o)
to Float
if (o == null) {
    return null;
return Float.valueOf(String.valueOf(o));
FloattoFloat(Object ob, Float defaultFloat)
to Float
if (ob == null) {
    return defaultFloat;
if (ob instanceof Integer) {
    return ((Integer) ob).floatValue();
} else if (ob instanceof Float) {
    return ((Float) ob).floatValue();
} else if (ob instanceof Double) {
...
FloattoFloat(Object obj)
to Float
if (obj instanceof String)
    return Float.valueOf((String) obj);
if (obj instanceof Byte) {
    Byte b = (Byte) obj;
    return b.floatValue();
if (obj instanceof Short) {
    Short s = (Short) obj;
...
floattoFloat(Object obj)
to Float
return toFloat(obj, 0);
floattoFloat(Object obj)
Get the float value of this object, only if the object is an instance of Number
return (obj instanceof Number) ? ((Number) obj).floatValue() : 0.0f;