Sorting an Array

Sort arrays of integers effortlessly in Java using the Arrays.sort() method, simplifying data manipulation tasks.

Sorting an Array
Photo by Mike Kenneally / Unsplash

Sort arrays of integers effortlessly in Java using the Arrays.sort() method, simplifying data manipulation tasks.

import java.util.Arrays;

public class ArraySorting {
    public static void main(String[] args) {
        int[] numbers = {5, 2, 9, 1, 5, 6};
        Arrays.sort(numbers);
        System.out.println("Sorted Array: " + Arrays.toString(numbers));
    }
}