I'm trying to populate an array with numbers 1-10 of size 100 and then finding the average of the array and i can't seem to figure out where i'm going wrong. (the multiple methods are required...also i'm not too sure how to correctly use multiple methods. possibly where i'm going wrong.)
import java.util.Random; public class wtf { public static void main(String[] args) { int [] values = new int [100]; populateArray(values); } public static void populateArray (int []values ) { Random generator = new Random(); for (int z = 0; z < values.length; z++) { values[z] = generator.nextInt(10) + 1; } average (values); } public static void average (int values [] ) { int sum = 0; for (int r = 0; r < values.length; r++) { sum = sum + values [r]; sum = sum/values.length; } System.out.println ("The average is " + sum); } }