Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class Main {
- public static void main(String[] args) {
- int[] vetor = new int[] {1,2,3,2,1};
- BuscaLinear busca = new BuscaLinear(vetor);
- busca.buscaLinear(2);
- ArrayList<Integer> repetidos = busca.getRepetidos();
- int repetido = busca.getRepete();
- System.out.println("número repetido " + repetido + " vezes, nas posições: ");
- for (int i = 0; i < repetidos.size(); i++)
- {
- System.out.printf("número na posição %d\n", repetidos.get(i));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement