0

I have an array which contains 12 numbers and I want to save this 12 numbers in 12 floats.generally how should I do this and save each one of them in one float?

array numbers = { a,b,c,....}
object1 = a;
object2 = b;
4

2 に答える 2

2
int[] numbers = { 1, 2, 3, 4, 5, ... };
float f1 = (float) numbers[0];
float f2 = (float) numbers[1];
...
于 2012-06-18T09:45:56.167 に答える
1
int[] numbers = { 1, 2, 3, 4, 5, 6 };

float[] num_floats = new float[numbers.length];

for (int i = 0; i < numbers.length; i++)
{
    num_floats[i] = (float) numbers[i];
}
于 2012-06-18T09:55:41.797 に答える