1. Write a method populateWithSquares that takes an array of ints as its lone input. It does not return anything, but the array will be changed so that its contents are numbers, where the element at position k will be k2.
2. Print out the contents of the array to verify that populateWithSquares is doing what you want.
Here is some code to get you started:
public static void main(String[] args) { int[] nums = new int[9]; // 9 is arbitrary--use some other number if you like! populateArray(nums); printArray(nums); } public static void populateArray(int[] nums) { // You write code here } public static void printArray(int[] nums) { // You write code here, too }