Array Manipulation in Java
Array Manipulation in Java
1. Copying an array
2. Reversing an array
3. Finding the maximum and minimum values
4. Finding the sum and average of elements
1. Copying an Array
Copying an array means creating a duplicate array with the same elements. There are multiple
ways to copy an array in Java:
2. Reversing an Array
Reversing an array means swapping the first element with the last, the second with the second
last, and so on.
Arrays.sort(arr, Collections.reverseOrder());
int sum = 0;
for (int num : numbers) {
sum += num;
}