Java Float Number Convert to convertFloat(String str, float defaults)

Here you can find the source of convertFloat(String str, float defaults)

Description

convert Float

License

Apache License

Declaration

public static float convertFloat(String str, float defaults) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static float convertFloat(String str, float defaults) {
        if (str == null) {
            return defaults;
        }//from w w  w  .j  a  v a2 s .com
        try {
            return Float.parseFloat(str);
        } catch (Exception e) {
            return defaults;
        }
    }
}

Related

  1. convertFloat(float amount, boolean speech)
  2. convertFloatArray(float[] arr)
  3. convertFloatArrayToString(float[] value, String separator)
  4. convertFloatBitsToHFloat(final int floatBits)
  5. convertFloatDouble(float[] in)