Please advise the easiest way to sort an array of integers. I just recently started coding in java and would like to find how to do it quickly.
I think nothing is easier
import java.util.Arrays;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] array = new int[n];
for(int i = 0; i < n; i++) {
array[i] = sc.nextInt();
}
Arrays.sort(array);
System.out.println(Arrays.toString(array));
}
}