sapreste dirmi perchè mi da l'eccezione array index out of bounds:-1 riguardo al metodo aggiungiIntervento?codice:public boolean aggiungiIntervento(InterventoVeicolo v){ int pos=0; InterventoVeicolo[] ni=new InterventoVeicolo[this.in.length+1]; if(this.in.length==0){ this.in=new InterventoVeicolo[1]; this.in[0]=v; return true; }else{ for(int i=0;i<this.in.length;i++){ if(this.in[i].getCodice()==(v.getCodice())) return false; } } int j=ni.length-1; while(this.in[j-1].getPrezzo()>=v.getPrezzo()){ ni[j]=this.in[j-1]; j--; } pos=j; ni[pos]=v; for(int a=0;a<pos;a++) ni[a]=this.in[a]; this.in=ni; return true; }
grazie!