I'm currently learning Java and while I'm able to find the largest number I'm stuck on how to find it's location. Any help would be greatly appreciated!
import java.util.Random;
public class FindingLargestValueInAnArray {
public static void main(String[] args) {
Random number = new Random();
int[] array_1 = new int[10];
int i = 0;
for (i = 0; i < array_1.length; i++) {
int randNum = 1 + number.nextInt(99);
array_1[i] = randNum;
}
System.out.print("Array:");
for (i = 0; i < array_1.length; i++) {
System.out.print(" " + array_1[i]);
}
int largeNumb = 0;
for (i = 0; i < array_1.length; i++) {
if (array_1[i] > largeNumb) {
largeNumb = array_1[i];
}
}
System.out.println("\n\nThe largest value is
"+largeNumb);
}
}