public void setMaxParticleNumber(int maxParticles) {
        if (maxParticles <= 0) {
            throw new IllegalArgumentException("The maximum particle number cannot be set to zero or less!");
        }
        
        if (particleArray == null || maxParticles != particleArray.length) {
            particleArray = new Particle[maxParticles];
        }
    }