List of utility methods to do Float Number Create
float | toFloat(short half) Converts a single precision (32 bit) floating point value into half precision (16 bit). switch ((int) half) { case 0x0000: return 0f; case 0x8000: return -0f; case 0x7c00: return Float.POSITIVE_INFINITY; case 0xfc00: ... |
float[] | toFloat(short[] arr) Converts an array of short values to an array of float values. int n = arr.length; float[] converted = new float[n]; for (int i = 0; i < n; i++) { converted[i] = arr[i]; return converted; |
float[] | toFloat(short[] src) Convert an array of short 's into an array of float '. int number = src.length; float[] dst = new float[number]; for (int j = 0; j < number; ++j) { dst[j] = (float) src[j]; return dst; |
float | toFloat(String parameter) to Float return Float.parseFloat(parameter);
|
float | toFloat(String property, float f) tries to parse the given String into a float value if this fails the default value is returned try { return Float.parseFloat(property); } catch (NumberFormatException ex) { return f; |
Float | toFloat(String s) to Float try { return Float.parseFloat(s); } catch (NumberFormatException e) { return new Float(0); |
double | toFloat(String s) Converts a string into a float return Float.parseFloat(s);
|
float | toFloat(String s) to Float return toFloat(s, -1);
|
float | toFloat(String str) Convert a If the string NumberUtils.toFloat(null) = 0.0f NumberUtils.toFloat("") = 0.0f NumberUtils.toFloat("1.5") = 1.5f return toFloat(str, 0.0f);
|
float | toFloat(String str) to Float if (isNumeric(str)) return Float.valueOf(str); return 0; |