like this for (int i = bottles.length-1; i>=0; iâ€“) {} i am having another issue with the remove

my code is long but please be patient; look for void removebottle() inside the class

```
ArrayList<Trash> trash ;
//Trash[] trash = new Trash[5];
PImage[] bottles = new PImage[3];
float time = 0;
PImage img;
PImage fish;
void setup() {
size(640, 640);
fish = loadImage("fish.png");
img = loadImage("aceituna.png");
trash = new ArrayList<Trash>();
for (int i = 0; i < bottles.length; i++) {
bottles[i] = loadImage("water-bottle-"+i+".png");
}
for (int i = 0; i < 5; i++) {
int index = (int(random(0, bottles.length)));
trash.add(new Trash(bottles[index], 120+i*100, 645, random (32, 72)));
}
}
void draw() {
background(30);
noStroke();
fill(0);
rect(0, height/2, width, height/2);
for (Trash part : trash) {
part.fish();
part.bouncingseagal();
part.move();
part.removebottle();
part.display();
}
//waves
float x = 0;
stroke(30);
strokeWeight(10);
while (x < width) {
point(x, 285+50 *noise(x / 100, time));
point(x, 295+50 *noise(x / 100, time));
point(x, 310+50 *noise(x / 100, time));
x = x + 1;
}
time = time + 0.02;
}
class Trash {
float x;
float y;
float speedY = 0.5;
float randomSize;
float offSetThis = 10;
float scalarThis = 3;
float yay;
float diamW = int(900/400), diamH = int(800/400);
PImage bottle;
float upDown = 0.0;
float speedTrash =.04;
//seagal
float xE = 0;
float yE = 0;
float ellipseXSpeed = 1;
float ellipseYSpeed = 1.4;
//fish variables
float xLoc = -250;
float yLoc = 400;
float angle = 0.0;
float offset = 150;
float scalar = 50;
float speed =.04;
boolean gLeft, gRight;
//rectangel
int rectW = width;
int rectH = height/2;
int rectX = 0, rectY = height/2;
Trash(PImage tempImg, float tempX, float tempY, float tempD) {
x = tempX;
y = tempY;
randomSize = tempD;
bottle = tempImg;
}
void fish() {
randomSeed(0);
int wW = int (320/3);
int wH = int (215/3);
int r = (int) random(-5, 5);
float y1 = offset + sin(angle) * scalar;
float y2 = offset + sin(angle + .4) * scalar;
float y3 = offset + sin(angle + .8) * scalar;
float y4 = offset + sin(angle + 1.2) * scalar;
if (mouseX > xLoc+r && mouseX < xLoc+r + wW*r && mouseY > yLoc+y1
&& mouseY < yLoc+y1 + wH*r) {
tint(255, 0, 0);
} else {
noTint();
}
image(fish, xLoc+r, yLoc+y1, wW*r, wH*r);
image(fish, xLoc+r, yLoc+y2, wW, wH);
image(fish, xLoc+150, yLoc+y3+50, wW*r, wH*r);
image(fish, xLoc+50, yLoc+y4, wW, wH);
angle += speed;
if (y + rectH >= height/2) {
gRight = true;
xLoc++;
if (xLoc <= -100) {
gRight = true;
gLeft = false;
}
if ( gRight == true) {
xLoc = xLoc+2;
}
if (xLoc + wW >= width + wW * 2) {
gLeft = true;
xLoc = xLoc *-1;
}
if (xLoc > width + wW * 2) {
gLeft = true;
gRight = false;
}
if (gLeft == true) {
xLoc--;
}
}
}
void bouncingseagal() {
int w = int(370/3);
int h = int(215/3);
smooth();
imageMode(CORNER);
noTint();
image(img, xE, yE, w, h);
xE += ellipseXSpeed;
yE += ellipseYSpeed;
if (xE < 0 || xE + w/2 > width - w/2) {
ellipseXSpeed *= -1;
}
if (yE < 0 || yE + h/2 > height/2 - h/2) {
ellipseYSpeed *= -1;
}
//detect moving square
//if (xE+s+ellipseXSpeed > x && xE + ellipseXSpeed < x+diamW
// && yE+s>y && yE < y + diamH) {
// ellipseXSpeed *= -1;
//}
//if ( xE + s > x && xE < x + diamW && yE + s + ellipseYSpeed > y
// &&yE + ellipseYSpeed < y + diamH) {
// ellipseYSpeed *= -1;
//}
}
void move() {
if (y + diamH > height) {
speedY *= 1;
}
y--;
if (y + diamH < height/2 + 40) {
y = y + y;
speedY *= -1;
}
}
void removebottle() {
for (int i = bottles.length-1; i>=0; i--) {
bottles[i] = bottles[i].get();
if (mouseX > x && mouseX < x + diamW * randomSize && mouseY > y + yay
&& mouseY < y + yay + diamH * randomSize) {
trash.remove(i);
}
}
}
void display() {
imageMode(CENTER);
yay = offSetThis + sin(angle) * scalarThis;
noTint();
image(bottle, x, y+yay, diamW * randomSize, diamH * randomSize);
}
}
```