Re: How should i do this?
One way would be to simply use String arrays (String) so you can pick each line apart the first dimension represents each line and the second dimension represents each word in that line. It's brute force in terms of data structure, but it's simple and lets you access what you need to in the positions you need. I'd have to look at the Java tutorials to see about sorting, but you can do that just as easily too.
Alternatively, you could construct a Map where each entry is an input line and the key is the word in that line whose index your second parameter specified.