import java.util.*; public class ArrayExample { public static void main(String[] args) { // value semantics int x = 5; int z = x; // reference semantics // Think about how many new arrays are being created. // Remember there are two ways to create a new array: // 1) using the "new" keyword -- new int[] // 2) using quick initialization -- {...} // Here we are only creating one new array, and // two references to that array. int[] data = {-8, 274, -54, 782, 92, 42, -384, 17}; System.out.println(Arrays.toString(data)); absoluteValue(data); System.out.println(Arrays.toString(data)); } public static void absoluteValue(int[] data) { for (int i = 0; i < data.length; i++) { data[i] = Math.abs(data[i]); } } }