Ok so I'm using a buffered reader to read a file and it works alright but my problem is I have integers in this file I have to find and place into an array and I don't know how to do this(feel so stupid). I'm trying to work on a travelling salesman problem using a 2d array where each integer found is stored in the array but I have no idea how to implement this. The sorting bit I've got but the other part I don't please Help!!!
yazz110
0
Newbie Poster
Recommended Answers
Jump to PostIf you know the order of the matrix, then everything should be straight forward...
Instead of using a BufferedReader, use a Scanner to "decorate" the File stream.Now you can use nextInt() method to read ints one by one.
And as you do use the simple nested forloop …
Jump to PostIs there any specific format?
if each row was writtin in each line and each element seperated by "," then you can read the entire line using "nextLine()" method of scanner and then you can tokeninze your string using "," as the delimiter. and you can parse the string …
All 6 Replies
stevanity
4
Posting Whiz in Training
yazz110
0
Newbie Poster
stevanity
4
Posting Whiz in Training
yazz110
0
Newbie Poster
stevanity
4
Posting Whiz in Training
yazz110
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.