Hey,I have to read in Integers from a file.I want to pass each integer to a method in turn.The methods that I am passing the integer too has only one parameter.What is the best way to do this.I want to do this so I don't need to type out statements to search for each number from the text file.
//This is inside a main method
Search S = new Search(110, 167);
//Creates my search array and hash arrays
This post has been edited by RourkeOkeffe: 28 November 2012 - 04:59 PM
pbl's code is all you need. To read them again, you don't. Store the integers you have read in first to an Array (or ArrayList if you don't know the amount of integers). You are then free to use the integers as you like.
Perhaps something like, extending pbl's code: (Will need to be changed depending on the context of use)
ArrayList<Integer> myInts = new ArrayList<>();
for (Integer i : myInts)