Hello, I'm a former MatLab user and I'm struggling with very basic operations in JAVA, right now I need a dynamic array (variable size), so I used java.util.Vector. But now I need to get the sum of all elements in the vector, how on earth can I do that ?
As I don't see anything to sum all the element in the vector class, I tried;
But it doesn't work because elementAt return an object. I don't really know how it works, because this vector is, in reality, only made of 'double'.Code:double sum = 0;
for(int i=0; i<myVector.size(); i++){
sum = sum + myVector.elementAt(i);
}
