I've been banging my head over this for a couple days now and I just can't figure it out. I'm supposed to read a set of integers into an array and then find the duplicates and display the locations of the duplicate integers. I was thinking that creating two arrays with the same integers then comparing would be the solution, but I have no idea how to set that up. As you can see getting the integers into the array was fairly simple, but any help with getting started with the rest would be greatly appreciated.
public static void dupInteger(String filename){ try{ Scanner sc = new Scanner(new File(filename)); int [] numArray = new int[100]; int n = 0; while(sc.hasNextInt()){ if(n >= numArray.length ){ System.err.println("Too much data"); System.exit(1); } numArray[n] = sc.nextInt(); //System.out.println(numArray[n]); n++; } for(int i = 0; i <= numArray.length; i++) System.out.println(numArray[i]); } catch (IOException e){ System.out.println(e); } }