ascending order using the built-in Arrays.sort() method :import java.util.Arrays;
public class SortArrayAscending {
public static void main(String[] args) {
int[] arr = {5, 7, 18, 3, 1, 12, 36};
Arrays.sort(arr);
System.out.println("Array sorted in ascending order: " + Arrays.toString(arr));
}
}Array sorted in ascending order: [1, 3, 5, 7, 12, 18, 36]arr and initialize it with the values {5, 7, 18, 3, 1, 12, 36};. Arrays.sort() method to sort the array in ascending order. Finally, we print the sorted array to the console using System.out.println() and Arrays.toString().