Ola pessoal, estou tendo problemas com esse código de um algoritmo de classificação.Ele compila, mas para no meio da execução.
import java.util.Random;
public class ClassificBolha
{
static int[] vet = new int[10];
static Random random = new Random();
public static void main(String args[])
{
preencheVet();
for(int i = 0; i < vet.length; i++)
{
System.out.printf("| %d |",vet[i]);
}
System.out.println();
bolha();
System.out.println();
for(int i = 0; i < vet.length; i++)
{
System.out.printf("| %d |",vet[i]);
}
}
public static void preencheVet()
{
for(int i = 0; i < vet.length; i++)
{
vet[i] = random.nextInt(100);
}
}
public static void bolha()
{
int aux;
boolean houveMudanca = true;
while(houveMudanca)
{
for( int i = 0; i < vet.length - 1; i++ )
{
if(vet[i] > vet[i+1])
{
aux = vet[i];
vet[i] = vet[i+1];
vet[i+1] = aux;
houveMudanca = true;
}
}
}
}
public static int[] getVet()
{
return vet;
}
}
//obrigado. :roll:
blz!valeu!