I got trouble reading a line and breaking the numbers up

Hi. I am trying to read a text file with sample data such as:
1 435 345345 3 43535
and so fourth. Basiclly is a line containing many numbers. How can i read them as individual integers? I can't find a source on the web that explain a method to solve this problem.. I used the bufferReader and the readline method but i am stuck on what to do next so i can read them as indivudal integers. Can anyone help me out please?
Thank you.

Once you've got a String with readLine, use String.split or a StringTokenizer to split the String into individual tokens.
Then, call Integer.parseInt or Double.parseDouble on those tokens.

Similar Messages

  • My iPad recently started to act up. I was using Google to find some information on birthday cakes and recipes. I selected 'images' but instead of the little thumbnails I got computer code. Lines and lines of the stuff. This only happened yesterday. The iP

    I see this problem has been posted before , but no advice has been added , please help if possible .
    My iPad recently started to act up. I was using Google to find some information on birthday cakes and recipes. I selected 'images' but instead of the little thumbnails I got computer code. Lines and lines of the stuff. This only happened yesterday. The iPad was working perfectly up to then. I am having no other problems. Google images work fine on my iPhone and my Mac Book. I would be very grateful if somebody could help.

    The problem is absolutely not Reader. The problem is that FireFox has stepped in front of Reader and handles all the PDF stuff - wrongly in your case. FireFox is DESIGNED to take over PDF files. But it is not capable of doing IRS forms!
    To start with go back to IE for these forms. When you save them to disk DO NOT DOUBLE CLICK ON THEM until this is fixed. Just open the in the normal way - start Adobe Reader and use Open from the File menu.

  • I have trouble reading in Black and White. changing the background color for all

    I have trouble reading in Black and White. On my PC I can change the background  color (and I am not just talking about for a word or pages document) but for eveything so anything that was a white background I can put in what ever color I like but it still prints in Black and white.. I can't see how to do this on the Macbook air. on my PC I do this in display. Sort of putting colored film over the screen I dont know what to do. Can anyone help?

    Hello Floridamacbookpro,
    You may be interested in the 'invert colors' Accessibility feature. This can be invoked by pressing the Control, Option, Command, and 8 keys on your keyboard. This only affects your display, and does not have any affect on printed items.
    Mac OS X displays inverted image colors (white on black, reverse type)
    http://support.apple.com/kb/HT3488
    Cheers,
    Allen

  • Got to end of trial period for Adobe reader XI and cannot revert back to old version or install another version b/c it says I have a newer more functional version, so now I've got no reader at all and cannot fix. Any ideas how to overcome this?.

    Got to end of trial period for Adobe reader XI and cannot revert back to old version or install another version b/c it says I have a newer more functional version, so now I've got no reader at all and cannot fix. Any ideas how to overcome this?.

    YOu need to be clear about the products you are using, so we can help you. In particular there is no trial of Adobe Reader, it is free and keeps running. Sounds like you are using some versions of Acrobat - which?
    YOu must properly uninstall the trial, don't just delete files or you may get a mess impossible to recover.

  • I'm having trouble with iTunes synching and accessing the iTunes store.

    I'm having trouble with iTunes synching and accessing the iTunes store.   When synching, the process tops at the back up stage, freezes and I can't close the iTunes window, need to ctrl alt del.   When trying to access the store, the progress bar stops halfway.   I've googled heaps and tried most of the standard answers - unistall, reinstall, etc, now looking for some help please.
    This has only started a few weeks back, after working smoothly for the 2 years of owning the iPhone 3gs.
    Any suggestions will be appreciated, it's getting realy frustrating.
    Cheers for now,
    Marty

    http://support.apple.com/kb/HT1923?viewlocale=en_US
    this worked perfectly for me, with no loss of library! BUT was warned about uninstalling things in the order listed...FYI.

  • I bought extenscript toolkit cc, in a monthly payment of 35 nic. i did everything acording to the instructions and the program i got is adobe aplication manager. and not the program for proccesing a picture - extenscript toolkit cc. please help me. hanan

    i bought extenscript toolkit cc, in a monthly payment of 35 nic. i did everything acording to the instructions and the program i got is adobe aplication manager.
    and not the program for proccesing a picture - extenscript toolkit cc.
    please help me.
    hanan epshtain

    I bought using the software Adobe Creative Cloud for one year.
    I pay in installments months 35 Nice ..
    Adobe sent me an inappropriate application ... I can not get the software I ordered ... I'm asking for help ..
    Unable to send email service department to get answers ..
    This problem ..
    Thank you
    Hanan.

  • How to read XML file and update the data in MS CRM 2011?

    Hi Folks,
    Can anyone please help me finding some references to read XML files and push the data to MS CRM 2011 preferably by using a console application.
    Please let me know if any ways of handling it in simple ways.
    Thanks,
    Sri

    HI,
    How to read XML file:
    https://social.msdn.microsoft.com/Forums/en-US/5dd7261b-86c4-4ca8-ba87-95196ef3ba50/need-to-display-xml-file-in-textboxes-edit-the-data-and-save-the-new-xml-file?forum=csharpgeneral
    How to work with CRM:
    ClientCredentials credentials = new ClientCredentials();
    credentials.Windows.ClientCredential = new System.Net.NetworkCredential("USER", "Password", "Domain");
    Uri uri = new Uri("http://server/Organization/XRMServices/2011/Organization.svc");
    OrganizationServiceProxy proxy = new OrganizationServiceProxy(uri, null, credentials, null);
    proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
    IOrganizationService service = (IOrganizationService)proxy;
    //using "service" you can create, update and retrieve entities.
    More information here about service functions:
    https://msdn.microsoft.com/en-us/library/gg328198.aspx

  • After reading a gmail and deleting, the message reappears on my screen, i now show 400 plus min my inbox.

    As I read my gmail and delete, the entry disappears on my screen.. However, It reappears on my screen the next time i open gmail with the inbox. I now show over 400 messages in inbox some going back to deletions in november.

    A possible cause is security software (firewall,anti-virus) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox and the plugin-container from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.org/kb/Server+not+found
    *https://support.mozilla.org/kb/Firewalls
    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode

  • When starting Final Cut Pro 7.0.3 I am all of a sudden getting a message that says "One or more of the scratch disks don't have read/ write access" and now the app won't operate - how do I fix this so I can use Final Cut Pro?

    When starting Final Cut Pro 7.0.3 I am all of a sudden getting a message that says "One or more of the scratch disks don't have read/ write access" and now the app won't operate - how do I fix this so I can use Final Cut Pro?

    Glad you found the answer.  But something seems wrong.  FCP should be able to assign the scratch disk to your startup drive.  It's not advisable, but it should be possible.  You might want to try and figure out what's going on before what ever's going on cause other problems.

  • I had the galaxy 3 withwifi issues. I recently obtained the droid maxx. it says that I am connected but over the past two months I've gone over data!  I have two lines , we checked the numbers in "my verizon" and it pretty much validated our suspicions! i

    I had the galaxy 3 with no wifi issues. I recently obtained the droid maxx. it says that I am connected but over the past two months I've gone over data!  I have two lines , we checked the numbers in "my verizon" and it pretty much validated our suspicions! it's this phone. Is there something I should check? It says connected to wifi, wifi is fine.....confused.

    Kimberly1966 we'll solve this mystery and put an end to the overage! Do you disable data when connected to Wi Fi? If not, I would recommend doing so to prevent accidental usage by http://vz.to/V4epNo
    AshleyS_VZW
    Follow us on Twitter @VZWSupport

  • TS1386 I purchased a tv show and  got an error message 39, and now the show I purchased isn't even displayed!!!!!

    I purchased a tv show episode and got an error message 39 and now the show isn't even displayed in my I tunes account!!!!!!!!!!!!!

    What is the exact errror message?  Was it similar to the one in this Apple support document?
    iTunes: May be unable to transfer videos to iPhone, iPad, or iPod
    B-rock

  • Preorders, reservations and walkins, the numbers don't lie. All good!!!!

    With all the worry and frustration I've been reading, i started thinking about the numbers behind the preorders and reservation. When you lay out the facts, it really sounds a whole lot better and you should feel comfortable after reading this.
    Apple said they sold 600000 preorders, there are say 250 Apple stores worldwide according to the Apple site. Lets say each store was allotted 2500 reserved and 2500 walk ins ( high but just follow the logic), thats 5000 per store x 250 stores = 1250000. Thats a total of 1850000. Now all the reports I've read on the net were saying that apple was producing 3000000 per month. Just say they only were in production for 2 months which is unlikely, thats still 6 million phones available on launch day and we figured we only need 1.85 just to fulfill our preorders, reserved and walk In's.
    This is why I feel comfortable knowing I have a phone on the 24th. I reserved mine for pickup @ my local Apple store because I have to work and will not be home to sign. I will try and go before work, but if i can't will be going after.

    Depends on the production schedule, but I think they will get new shipments at least weekly if not sooner, so not bad i would say. The problem is the sell out rate. Tell you what i did with the iPad, any big city Apple store I called was sold out, so I looked for the smallest populated area and found one. I drove about 25 extra miles, but it was well worth it.
    Good luck.

  • Having trouble reading specific lines from a text file and displaying them in a listbox

    I am trying to read specific lines from all of the text files in a folder that are reports. When I run the application I get the information from the first text file and then it returns this error: "A first chance exception of type 'System.ArgumentOutOfRangeException'
    occurred in mscorlib.dll"
    Below is the code from that form. 
    Option Strict On
    Option Infer Off
    Option Explicit On
    Public Class frmInventoryReport
    Public Function ReadLine(ByVal lineNumber As Integer, ByVal lines As List(Of String)) As String
    Dim intTemp As Integer
    intTemp = lineNumber
    Return lines(lineNumber - 1)
    lineNumber = intTemp
    End Function
    Public Function FileMatches(ByVal folderPath As String, ByVal filePattern As String, ByVal phrase As String) As Boolean
    For Each fileName As String In IO.Directory.GetFiles(folderPath, filePattern)
    If fileName.ToLower().Contains(phrase.ToLower()) Then
    Return True
    End If
    Next
    Return False
    End Function
    Private Sub frmInventoryReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim intcase As Integer = 1
    Dim strTemp, strlist, strFile As String
    Dim blnCheck As Boolean = True
    strFile = "Report Q" & intcase.ToString & ".txt"
    Do While blnCheck = True
    strFile = "Report Q" & intcase.ToString & ".txt"
    Dim objReader As New System.IO.StreamReader("E:\Furry Friends Animal Shelter Solution\Furry Friends Animal Shelter\" & strFile)
    Dim allLines As List(Of String) = New List(Of String)
    Do While objReader.Peek <> -1
    allLines.Add(objReader.ReadLine())
    Loop
    objReader.Close()
    strlist = ReadLine(1, allLines) & "" & ReadLine(23, allLines)
    lstInventory.Items.Add(strlist)
    intcase += 1
    strTemp = intcase.ToString
    strFile = "Report Q" & intcase.ToString & ".txt"
    blnCheck = FileMatches("E:\Furry Friends Animal Shelter Solution\Furry Friends Animal Shelter\", "*.txt", intcase.ToString)
    Loop
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim intcase As Integer = 1
    Dim strTemp, strlist, strFile As String
    Dim blnCheck As Boolean = True
    strFile = "Report Q" & intcase.ToString & ".txt"
    Do While blnCheck = True
    strFile = "Report Q" & intcase.ToString & ".txt"
    Dim objReader As New System.IO.StreamReader("E:\Furry Friends Animal Shelter Solution\Furry Friends Animal Shelter\" & strFile)
    Dim allLines As List(Of String) = New List(Of String)
    Do While objReader.Peek <> -1
    allLines.Add(objReader.ReadLine())
    Loop
    objReader.Close()
    strlist = ReadLine(1, allLines) & "" & ReadLine(23, allLines)
    lstInventory.Items.Add(strlist)
    intcase += 1
    strTemp = intcase.ToString
    strFile = "Report Q" & intcase.ToString & ".txt"
    blnCheck = FileMatches("E:\Furry Friends Animal Shelter Solution\Furry Friends Animal Shelter\", "*.txt", intcase.ToString)
    Loop
    End Sub
    End Class
    Sorry I'm just beginning coding and I'm still a noob. Any help is appreciated. Thank you!

    Ok, so if I'm following this correctly you should be able to just loop through all of the files in that folder whose file name matches the pattern and then read the first 22 lines, recording only the first and the last.
    Exactly how you store the animal data probably depends on how you are going to display it and what else you are going to do with it.  Is there anything other than name and cage number that should be associated with each animal?
    You might want to make a dataset with a datatable to describe the animal, or you might write a class, or you might just use something generic like a Tuple.  Here's a simple class example:
    Public Class Animal
    Public Property Name As String
    Public Property Cage As String
    Public Overrides Function ToString() As String
    Return String.Format("{0} - {1}", Name, Cage)
    End Function
    End Class
    With that you can use a routine like the following to loop through all of the files and read each one:
    Dim animals As New List(Of Animal)
    Dim folderPath As String = "E:\Furry Friends Animal Shelter Solution\Furry Friends Animal Shelter\"
    For Each filePath As String In System.IO.Directory.GetFiles(folderPath, "Report Q?.txt")
    Using reader As New System.IO.StreamReader(filePath)
    Dim lineIndex As Integer = 0
    Dim currentAnimal As New Animal
    While Not reader.EndOfStream
    Dim line As String = reader.ReadLine
    If lineIndex = 0 Then
    currentAnimal.Name = line
    ElseIf lineIndex = 22 Then
    currentAnimal.Cage = line
    Exit While
    End If
    lineIndex += 1
    End While
    animals.Add(currentAnimal)
    End Using
    Next
    'do something to display the animals list
    Then you might bind the animals list to a ListBox, or loop through the list and populate a ListView.  If you decided to fill a datatable instead of making Animal instances, then you might bind the resulting table to a DataGridView.
    There are lots of options depending on what you want and what all you need to do.
    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

  • How to read a file and save the line number of  the last line read?

    Hi,
    I am using RandomAccessFile and file as my class. I am trying to read a log file as it gets updated and print it out to a java window. i so far have the framework setup but dont know how to save the last line number so.
    i need this variable so i dont reprint out the same line numbers to the java window. please advise.
    thanks!

    hi,
    i now have the line number of the last line read, but now when i reopen the file, how can i skip that number of lines?
    thanks,

  • Getting Buffered Reader to read next line and update.

    Hello.
    I have been trying to get this program to read the next line in a txt file correctly. This is a GUI program
    where clicking the button is supposed to bring up the next bit of information for the user to see.
    I can get the first line of information to come out correctly, but I am unable to get it to read the next line when I click the next button.
    Here is a snippet of my coding...
    private JFileChooser fileChoose;
    private File openedFile;
    private int recordNumber = 0;
    FileReader inFile;
    String sMaker = new String (  );
    else if ( ae.getActionCommand (  ) == "Next Record" )
         if ( openedFile.exists (  ) )
              nextRecord (  );
         else
         JOptionPane.showMessageDialog ( null, "No Files Opened", "No Files Found", JOptionPane.ERROR_MESSAGE );
    public void nextRecord (  )
         recordNumber ++;  // Increment record number
         fileNumber.setText ( sMaker.valueOf ( recordNumber ) );  // Prints to JTextField for user to see
         BufferedReader inText;
         String lineRead;  // Holds line read in
         String [] organizedInfo;  // Array to hold info after being split
         try
              inFile = new FileReader ( openedFile );
              inText = new BufferedReader ( inFile );
              lineRead = inText.readLine (  );
              organizedInfo = ( lineRead.split ( "," ) );//.trim (  );
              for ( int i = 0; i < organizedInfo.length; i ++ )
                   organizedInfo[i] = organizedInfo.trim ( );
    name.setText ( organizedInfo[0] );
    city.setText ( organizedInfo[1] );
    state.setText ( organizedInfo[2] );
    catch ( FileNotFoundException fnfe )
    JOptionPane.showMessageDialog ( null, "Selected File was Not Found", "File Not Found", JOptionPane.ERROR_MESSAGE );
    catch ( IOException ioe )
    JOptionPane.showMessageDialog ( null, "IO Error. Please Try Again.", "IO Error", JOptionPane.ERROR_MESSAGE );
    employee.txt
    William Wallace,Richmond,VA
    Samuel Gompers , San Francisco , California
    Andy Smith,Rochester,NY
    Sandy Beach,Pittsford,NY
    Slim T. None,San Francisco,CA
    George Jones, Washington , D.C.
    Marvin Martin, Boston , Massachusetts
    I. M. Last , Deadmans Gulch, Arizona
    Everytime I click the next button, it should go through the list in employee.txt until i reach the end. But it just stops at William Wallace.
    I know that this can be recoded to make it more efficient, but before that, I still need to figure out how to get the line read to update to next line.
    Thank you in advance.

    Your program works perfectly correctly!
    Each time you click the button it reads the first line and displays it. Why? Because you create a new reader everytime you enter the nextRecord method and the reader reads the first line. Each new reader has no idea where the last reader was upto in your file. It has to start at the beginning.
    <cue response>How do I fix it?

Maybe you are looking for

  • Conversion Source system in DB Copy

    Hi developers, You can help me with the list of the steps for the activities necessary in order not to lose infosources mapping when I copy the systems and I must connect an other R/3 system Thanks Domenico

  • Problem while restoring backup from the pc to the ...

    hi all today i make two backups of my phone  ( nokia XpressMusic 5730 Symbiyan 60 3rd)  and then i restore all original phone settings  using *#7370# after that  i tried to recover the back up from the pc  but after it finished restoring the backup a

  • How do i get the password panel to come up??

    the only help i get drom apple is tro go to a dealer and pay for a new hard drive

  • I got Snow leopard and now I cant print with Canon 4350d

    Canon 4350 printer problem? I get this message every time I try to print. I can scan and copy but not print. "Cannot communicate with the printer, or the printer is not supported, check the printer connection and add it again. Then, if the print dial

  • Collections/sub-collections and sets in Flickr publishing service

    I have been searching in vain for a way to arrange the photo sets I upload to Flickr in folders and sub folders - just the same way I do it in Flickr with up to 5 levels of collections + sets. What I want is something like this: BIRDS ---------ORDER