Results 1 to 4 of 4
  1. #1
    Hazza is offline Member
    Join Date
    Oct 2012
    Posts
    64
    Rep Power
    0

    Default .txt file to multidimensional array

    I have a .txt file that contains either i's or j's. There are 7000 characters in total which are all either i or j. I need to place these into an array where each row is 70 characters long and there are a 100 rows in total. I have a custom package based on the buffered reader which can read in the values. I am pretty sure I need to use a loop to loop through all the character values but I am lost as to what loop to use and how to use it in the correct way. Any help would be greatly appreciated :) .

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: .txt file to multidimensional array

    Your loop should likely be a while loop that continues until the reader's readLine() method returns null. There are many examples of this to be found here and in other forums.

  3. #3
    Hazza is offline Member
    Join Date
    Oct 2012
    Posts
    64
    Rep Power
    0

    Default Re: .txt file to multidimensional array

    Okay but the only problem I have is that there is no readLine() method it can only read one character at a time?

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: .txt file to multidimensional array

    Well, wrap your reader in a BufferedReader then.
    Remember, we cannot see your code from here.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. .txt file to multidimensional array
    By Hazza in forum New To Java
    Replies: 1
    Last Post: 11-13-2012, 04:37 PM
  2. Multidimensional Array
    By TyCox94 in forum New To Java
    Replies: 11
    Last Post: 09-25-2011, 11:00 PM
  3. Multidimensional Array help
    By Gaebril in forum New To Java
    Replies: 1
    Last Post: 04-09-2011, 08:36 PM
  4. initialize multidimensional array
    By Aidoru in forum New To Java
    Replies: 2
    Last Post: 12-04-2010, 01:00 PM
  5. Retrieve Multidimensional Array ??
    By oneofthelions in forum New To Java
    Replies: 3
    Last Post: 12-12-2009, 07:24 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •