Answer the question
In order to leave comments, you need to log in
float array to int, is it possible?
There is an array of float type, I need to get its value in int multiplied by 100
That is, if the float array has a value of 0.4, then in the int array it should be 40
How can I do this? Couldn't figure out anything understandable.
Answer the question
In order to leave comments, you need to log in
float []arrFloat = {2.0, 0.1, 0.02};
int []arrInt = new int[3];
for(int i = 0; i < 3; i++){
arrInt[i] = (int)(Math.round(arrFloat[i]*100))
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question