Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Justin Char

Ranch Hand
+ Follow
since Mar 05, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Justin Char

I still don't understand how to get this to work?
8 years ago
I don't understand what you mean. I don't understand how that would work.

I can read a file with bufferedReader. I don't understand how to do the compare with the BufferedReader and hashset?
8 years ago
When I print it out it is eleven and eleven...
I don't even think that is the right way to go about doing it.
8 years ago
I have been working on this and tried the below if stmt.
says there are no matches but I know there are matches.
8 years ago
By File - Yes, I do mean a line - Sorry

I am trying to read the first 11 characters of the first line from one file and look for matches in the 1st 11 characters of the second file and find all the ones that match and write them out to a file. I know how to write them out to a file.

Just having problems on how I would compare the two files with scanner, or using an array or a for loop. I have no idea on how to do this and have it complete in under 15 minutes.

With scanner I could only get it to allow me to put in a series of numbers and match it to a line on one of the files.
8 years ago
I want to find the files that match in both files.
It will need to grab the first file number Run through 3million records to see if there is a match.
I will sort them by number so it won't have to go through all 3 million everytime.
Both files are not the same size.
8 years ago
Trying to compare two files one has 3 million records the other has 250,000
I want to loop through scanner with scanner2 line by line so if there is a match I can then substring file Number and a couple other fields off the file with 3 million records. Currently I can only put in a file number and find one record.
I don't understand what needs to be done to get oldfile2 to take 1st file number loop through oldfile if there is a match write out data then take 2nd file number and so on.

Thank you in advance for your help.

8 years ago
I got it!!!

I am good....Thank you...Really I am good....(smile)

Dum Dum Dum mistakes...

Thank you for all your help!!
8 years ago
I was wrong it isn't working still



I still can't get it to print out the total 2033208 by itself. It prints all 3 amounts everytime.

This is driving me nuts. Current Code below.

This shouldn't be that difficult. (smile) Maybe I am just not as smart as I thought I was.

8 years ago
I added this ("long Justin = iSUM += i;") to the last code you sent me and it now does what I needed it to do.
I tried using scanner like you said had problems. I will wait one day and then hopefully you can help me understand the scanner method.

Thank you very much for your assistance you saved me.
8 years ago
The numbers are in exactly the same place everytime. The one I sent you I had to paste so maybe things moved around. I couldn't send as attachment on here because tells me doesn't except txt files.

The problem is there are three numbers associated with iSUM and when It prints I get three results for iSUM
I only want to get one the total which as you can see above I get one of the numbers I am adding and two total amounts. The total Amounts are accurate. I just don't know what to do to get one result and have it be the total amount of 2033208.

When I do System.out.println(j) I get the three amounts I am adding.

When I do a System.out.println(iSUM) I get Three amounts - one amount being the first line I am adding and the following two the total I need. But I need it to print once not twice.

If you can help me with that I put up another post for at least a day (smile)

8 years ago
Took me more than 10 min (smile)

The 2033208 is the number I am looking for (but only that one number) as you can see my output shows three numbers and I don't know how to make it just my total number. I have looked at scanner and couldn't get it to work either.
8 years ago
I can't add an attachment says cannot send txt files..Just copy and put in text file. Delete (//)commented lines just notes so you know what numbers I am grabbing.

070 32**HV1


//1644382 this is the number in above string looking for to add with next two


//388826 2 nd number I want to add in above string 8 char field for each number


//00000000 this field is 0 zeros but could have 10 won't always be three numbers I am adding .

8 years ago
I put this in my while stmt. Just prints the 3 numbers that are in aInt variable..

8 years ago
I did multiply * 2 and it multiplied the first number but not the other two.

8 years ago