I want to create an ArrayList<Float> of length 350. I did this:
x = new ArrayList<Float>(350);
No i want this array to have ‘zero’ float value at each point. i can do this:
for (int i = 0; i< 350 ; i++){
x.add((float) 0.0);
}
So my question is if there is another way to do the same thing without iterating. I want minimum iterating to increase efficiency.
If you want efficiency I wouldn’t use
ArrayListorFloathere. I wouldn’t recommend usingfloateven as it’s precision is so poor, unless you really know what you are doing.I suggest you use an array of double.