Type a program that loads a vector with 10 integers and sorts it in ascending order using the bubble sort method.
The program should generate a second vector without the repeated numbers.
package com.bubble.sort;
import java.util.Scanner;
public class bubble_sort {
private static Scanner teclado;
public static void main(String args []) {
int vet1[] = new int [10];
int vet2[] = new int [10];
int n, i, aux,troca;
teclado = new Scanner(System.in);
//Carregando os números do vetor:
for(i=0;i<=9;i++) {
System.out.print("Digite "+(i+1)+"º número do vetor:");
vet1[i]= teclado.nextInt();
vet2[i] = vet1[i];
}
n = 1;
troca = 1;
while (n <= 10 && troca == 1) {
troca = 0;
for(i=0;i<=8;i++) {
if(vet1[i] > vet1[i+1]) {
troca = 1;
aux = vet1[i];
vet1[i] = vet1[i+1];
vet1[i+1] = aux;
}
}
n = n + 1;
}
for(i=0;i<=9;i++) {
System.out.print("["+vet1[i]+"]");
}
}
}