Convert into arraylist to add elements

Hi,

I am working with a code where there is a defined number of elements N_ATOMS proportionate to the screen size. I would like to add elements using MousePressed. However, there is no ArrayList in the code and I am not sure how to convert it. How can I increase N_ATOMS? I don’t mind losing the number being proportionate to the screen, I would just set a fix size and adjust the amount of elements consequently.

Thank you very much!

Atom[] atoms; 
int N_ATOMS; //number of atoms
final int WATER = 0; //-0
final int HYDROPHOBIC = 1; //adjust HC value -1
final int R = 10; // rayon d'action de la Strong Force (buffer perimeter around each atom) -6

//------------------------------------------------------------------------------
class Atom 
{
  public PVector position,velocity,acceleration;
  public int type;
  public Atom(int t){
    position = new PVector(random(width),random(height));
    velocity = new PVector(random(-3,3),random(-3,3));
    acceleration = new PVector();
    type = t;
  }
  
  public void drawAtom()
  {
    switch(type) {
      case WATER: fill(color(0)); break; //Water color
      case HYDROPHOBIC: fill(color(255)); break; //oil color
      default: fill(color(255)); break;
    }
    ellipse(position.x,position.y,max(4,R),max(4,R)); // change shape
  }
  
}
//------setup-----------------------------------------------------------------------------------
void setup()
{
  size(1000,1000,P2D); // change the size of the world here
  smooth();
  
  N_ATOMS = width * height / ( R * 100 ); // proportion number of atoms to window -70
  atoms = new Atom[N_ATOMS]; //create atoms
  for(int i=0;i<N_ATOMS;i++) //call all atoms
  {
    switch(i%3) { // water/oil ratio (more % = less oil) -%5
      default: atoms[i] = new Atom(WATER); break; 
      case 0: atoms[i] = new Atom(HYDROPHOBIC); break;
    }
  }
}

//-----------------------------------------------------------------------------------------------------------------

void draw(){
  
  background(198,216,230);
  
  for(int i=0;i<N_ATOMS;i++) // call all atoms
    atoms[i].drawAtom(); //display them
    
  // draw the mouse-controlled water atom
  fill(color(255)); //its color
  ellipse(mouseX,mouseY,max(4,R),max(4,R)); //position and size
}