Java program to sort an array of integers using the `Arrays.sort()` method:

import java.util.Arrays;

public class ArraySorting {

public static void main(String[] args) {

// Initialize an array of integers

int[] numbers = {5, 2, 9, 1, 7};

// Print the original array

System.out.println("Original array: " + Arrays.toString(numbers));

// Sort the array in ascending order


// Print the sorted array

System.out.println("Sorted array: " + Arrays.toString(numbers));



This program sorts the array `numbers` using the `Arrays.sort()` method, which sorts the array in ascending order by default. The sorted array is then printed to the console.