For whatever reason, the when I run this it always displays a number between 0-3, seemingly at random... Any help you could give me would be much appreciated.

import java.util.*; public class Ex93 { private static final int q = 0; public static void main(String[] args) { int rndArray[] = randomArray(10); printArray(rndArray); int indexMax = indexOfMaxInRange(rndArray); System.out.println("The largest number is in position 3" + indexMax); } public static int[] randomArray (int n) { int[] a = new int[n]; for (int i = 0; i<a.length; i++) { a[i] = randomInt (0, 100); } return a; } private static int randomInt(int low, int high) { int randReturn = 0; randReturn = (int) (high * Math.random()) + 1; return randReturn; } public static void printArray (int[] a) { for (int i = 0; i<a.length; i++) { System.out.println (a[i]); } } public static int indexOfMaxInRange(int[] a) { double[] b = new double [a.length]; int i = 0; while (i < 4) { b[i] = a[i]; i++; } Arrays.sort(B)/>; int max = (int) b[b.length-1]; int z=0; while (a[z] !=max) { z++; } return z; } }