Sorting an Array
Sort arrays of integers effortlessly in Java using the Arrays.sort() method, simplifying data manipulation tasks.
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));
}
}