List of utility methods to do Float Array to Int
int[] | ArrayFloat2Int(float[] a) Array Float Int int[] ret = new int[a.length]; for (int i = 0; i < a.length; i++) { ret[i] = (int) a[i]; return ret; |
String | floatArray2String(float[] array) float Array String String aux = "" + array[0]; for (int i = 1; i < array.length; i++) { aux += ("," + array[i]); return aux; |
String | floatArray2String(float[] xs) float Array String StringBuilder sb = new StringBuilder(); for (int i = 0; i < xs.length; ++i) { sb.append(Float.toString(xs[i])); if (i < xs.length - 1) { sb.append(","); return sb.toString(); ... |
byte[] | floatArrayTo16bitPCM(float[] raw) float Array Tobit PCM byte[] sample = new byte[raw.length * 2]; for (int i = 0, j = 0; i < raw.length; i++) { int pcm = (int) (raw[i] * 0x8000); sample[j++] = (byte) (pcm & 0xff); sample[j++] = (byte) (pcm >> 8 & 0xff); return sample; |