Considere o seguinte código Java, abaixo, implementado em condições ideais.
public class Elemento {
public static void main(String[] args) {
int[] vetor = {1, 2, 3, 4};
buscaElemento(vetor, 5);
}
public static int buscaElemento(int[] vetor, int elemento) {
for (int i = 0; i <= vetor.length; i++) {
if (vetor[i] == elemento) {
return i;
}
}
return -1;
}
}
Um técnico relatou que, ao executar esse código, ocorre uma exceção que