public float sum() { float sum = 0f; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { sum+= pixels[y,x]; } } return sum; }