I am new to the Java language. I'm currently trying bubble sort with the concept of functions and user input method. Can anyone help me to solve this particular issue of not getting any output?
import java.util.*;
public class Bubble {
public static void bubble_sort(int[] arr) {
for (int turn = 0; turn < arr.length - 1; turn++) {
for (int j = 0; j < arr.length - 1 - turn; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
static void print_array(int[] arr) {
System.out.println("" + arr.length + "values:");
for (int j: arr) {
System.out.print(j + " ");
}
System.out.println();
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] arr = new int[0];
int n;
n = sc.nextInt();
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
bubble_sort(arr);
print_array(arr);
}
}