Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 612819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:56:03+00:00 2026-05-13T17:56:03+00:00

I have a dynamic big File and I want check a Boolean value and

  • 0

I have a dynamic big File and I want check a Boolean value and then if it’s true, get count of a thing

please help me

for example this is my file (it maybe has 20000 lines)

.
.
.
fsfds fdsfsdf gfhgfh value1=true fdsfd fdfdsr ewref

dfdfsd dsfds  dfdf fdsfsd 
dfdfsd dsfds myval dfdf fdsfsd 
dfdfsd dsfds dfdf fdsfsd 
dfdfsd dsfds myval dfdf fdsfsd 

fdfdfddsfds
fdfdsfdfdsfdfdsfsdfdsfdsfdsfds
.
.
.

I wrote this code to handle it but I can’t because in this case I read Line by Line and I must check if value1 is true then in 2 line after I must count myval …

public void countMethod() {
        int i = 0; //count
        try {
            BufferedReader input =
                    new BufferedReader(new FileReader(new File("I:\\1.txt")));
            String line;
            while ((line = input.readLine()) != null) {
                if (line.substring(line.indexOf("value1")).split("=")[1].equals("true")) {
                    if (line.indexOf("myval") != -1)
                        i++;
                }
            }
            input.close();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("Count is : " + i);
    }

How can I check condition and after that if it’s true I count myvals?

Thanks a lot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:56:04+00:00Added an answer on May 13, 2026 at 5:56 pm

    If you only want to make one pass through the file, just inspect each line and check both its count of myval and whether it has value1 = true. You’ll know what the count of myval is, but you won’t have to report it unless value1 is true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have dynamic array filled with bytes, which are read from .raw file with
I have a dynamic text file that picks content from a database according to
I have a big file transfer (say 4gb or so) and rather than using
I have a welcome page (JSP file) for my application that contains some dynamic
I have a routine that repeatedly builds and rebuilds a big dynamic movieclip full
I have dynamic web page with JS. There is a <textarea> and a Send
I have dynamic content in a div called txtresults like this: <div id=txtresults></div> This
I have some divs that have dynamic heights controlled by a 'click' function as
I have some divs that have dynamic heights controlled by a 'click' function as
I have a dynamic SQL statement I've created in a stored procedure. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.