List of utility methods to do Float Number Convert to
String | convertFloat(float amount, boolean speech) Converts a float to speakable fraction representation int num = (int) amount; String start = Integer.toString(num); int remainder = (int) ((amount - num) * 1000); if (start.equals("0")) { start = ""; } else if (remainder > 0) { if (speech) { start += " and "; ... |
float | convertFloat(String str, float defaults) convert Float if (str == null) { return defaults; try { return Float.parseFloat(str); } catch (Exception e) { return defaults; |
Float[] | convertFloatArray(float[] arr) convert Float Array Float[] ret = new Float[arr.length]; for (int i = 0; i < arr.length; i++) { ret[i] = arr[i]; return ret; |
String | convertFloatArrayToString(float[] value, String separator) convert Float Array To String if (value.length == 0) { return ""; StringBuilder sb = new StringBuilder(); for (float v : value) { sb.append(v); sb.append(separator); sb.setLength(sb.length() - separator.length()); return sb.toString(); |
short | convertFloatBitsToHFloat(final int floatBits) convert Float Bits To H Float final int s = (floatBits >> 16) & 0x00008000; int e = ((floatBits >> 23) & 0x000000ff) - (127 - 15); int m = floatBits & 0x007fffff; if (e <= 0) { if (e < -10) { return (short) s; m |= 0x00800000; ... |
double[] | convertFloatDouble(float[] in) Convert a 1-D float array to double [] double[] out = new double[in.length]; for (int i = 0; i < out.length; i++) { out[i] = (double) in[i]; return out; |
float | convertFloatFromBytes(byte[] byteArray) convert Float From Bytes return convertFloatFromBytes(byteArray, 0);
|
float | convertFloatFromStream(byte[] stream, int intStart, int decStart, int intNumbers, int decNumbers) convert Float From Stream float dec; float num; float d; float thous = 0f, units = 0f, tens = 0f, hundreds = 0f, tenths = 0f, hundredths = 0f, thousands = 0f, tenthousands = 0f, hunthousands = 0f, millis = 0f; if (intNumbers > 3) { thous = getThousands(stream, intStart); intStart++; ... |
double[][] | convertFloatMatrixToDoubles(float[][] input, int dimRows, int dimColoumns) convert Float Matrix To Doubles if (input == null) { return null; double[][] output = new double[dimRows][dimColoumns]; for (int i = 0; i < dimRows; i++) { for (int j = 0; j < dimColoumns; j++) { output[i][j] = input[i][j]; return output; |
int[] | convertFloatsToFixed(float[] values) convert Floats To Fixed int[] fixed = new int[values.length]; for (int i = 0; i < values.length; i++) { fixed[i] = XDoubleToFixed(values[i]); return fixed; |