Java Utililty Methods Float Array to Int

List of utility methods to do Float Array to Int

  1. HOME
  2. Java
  3. F
  4. Float Array to Int

Description

The list of methods to do Float Array to Int are organized into topic(s).

Method

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;

AltStyle によって変換されたページ (->オリジナル) /