Привет, коллега, Stackoverflowers,Java: алгоритм сортировки вставки
Как распечатать цифрыArray, чтобы я мог видеть цифры?
Когда я SYSOUT в numbersArray, он показывает мне:
[I @ 677327b6
[I @ 677327b6
Спасибо за ваше время и помощь!
package AlgoExercises;
public class InsertionSort {
static int[] numbersArray = { 5, 2, 4, 6, 1, 3 };
static void swap(int a, int b) {
int temp = a;
a = b;
b = temp;
// a and b are copies of the original values.
// The changes we made here won't be visible to the caller.
}
static void insertionSort(int[] numbersArray) {
for (int i = 1; i < numbersArray.length; i++) {
int j = i;
while ((j > 0) && (numbersArray[j] < numbersArray[j - 1])) {
swap(numbersArray[j], numbersArray[j - 1]);
j = j - 1;
System.out.println(numbersArray);
}
}
}
public static void main(String args[]) {
insertionSort(numbersArray);
}
}