Created: 2023-09-02 18:47
Status: #concept
Subject: Programming
Tags: Java Class java.util Java Package

java.util.Arrays

This class contains various static methods for manipulating primitive T[] arrays (such as sorting and searching).

Common Methods

These are all static, so all we need is to import java.util.Arrays before using a Arrays.method().

int[] numbers = {8, 3, 7, 9, 1, 2, 4};
System.out.println(Arrays.toString(numbers));
Arrays.sort(numbers);
System.out.println(Arrays.toString(numbers));
[8, 3, 7, 9, 1, 2, 4]
[1, 2, 3, 4, 7, 8, 9]

References