Bom dia, estava tentando resolver um exercicio mas não consigo devolver os valores dentro do vetor para a classe main, alguém teria alguma solução?
Estou tentando gerar números aleatórios para ordenar em Bubble Sort, mas não consigo passar os valores, desde já agradeço.
public class Ordenacao {
public static void printVetor(tipoOrdenacao ord){
System.out.println("Vetor Desordenado = " + (ord.getVetor()));
}
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Bubble Sort");
Ordenacao.printVetor(new BubbleSort());
System.out.println("\n");
System.exit(0);
}
}
public abstract class tipoOrdenacao {
public abstract int[] getVetor();
}
import java.util.Random;
public class BubbleSort extends tipoOrdenacao{
Random r = new Random();
private int[] bubble = new int [100];
public int[] getBubble() {
return bubble;
}
public void setBubble(int bubble) {
for (int k=0; k < 5; k++){
this.bubble[k]=r.nextint(11);
}
for(int i=0; i < 5; i++) {
this.bubble[i] = bubble;
}
}
@Override
public int[] getVetor() {
return bubble[];
}
}