I have a binary image (size: 100x100) of a hand, that we can represent as a matrix composed only by 0 or 1 values. This is an example:

Assuming that I have an array of double representing the linearized image, and that we call it image, I need to perform the following operations:
double accumulator = 0;
for (int j = 0; j < image.Length; ++j)
{
accumulator += image[j] * weights[j];
}
In other words, I need to calculate the weighted sum of each pixel of the image array. weights represents an array that contains double values, and it is used to weight each pixel of the image.
Is the following code more efficient than the previous one?
double accumulator = 0;
for (int j = 0; j < image.Length; ++j)
{
if (image[j] != 0)
{
accumulator += image[j] * weights[j];
}
}