I have been working on this code for about a week; I am trying to make a program that generate random numbers and then sort them using the Bubble method, but I get this message "Bubble Sort: [I@ad3ba4". Does anyone see what is wrong I feel like this is so simple but I just can't find the problem.
import java.util.Random;
public class sortLibrary {
private static void bubbleSort(int[] list) {
int n = list.length;
int temp = 0;
for (int i = 0; i < n; i++) {
for (int j = 1; j < (n - 1); j++) {
if (list[j - 1] > list[j - 1]) {
temp = list[j - 1];
list[j - 1] = list[j];
list[j] = temp;
}
}
}
System.out.println("\nBubble Sort: " + list);
}
public static void main(String args[]) {
System.out.println("Unsorted list:");
Random numbers = new Random();
int list[] = new int[20];
for (int i = 0; i < 20; i++) {
list[i] = numbers.nextInt(100);
}
for (int i = 0; i < 20; i++) {
System.out.print(list[i] + " ");
}
bubbleSort(list);
}
}