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 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 dynamic query that returns around 590,000 records. It runs successfully the
I have a Dynamic Data Entities Web Application that uses a database with GUIDs
I have a dynamic class that serves as a storage container for configuration settings.
How can I have a dynamic variable setting the amount of rows to return
When C# 4.0 comes out and we have the dynamic keyword as described in
We're looking at doing a MOSS 2007 site which will have a fairly dynamic
(Eclipse 3.4, Ganymede) I have an existing Dynamic Web Application project in Eclipse. When
I have recently written a dynamic querying tool using expression trees and as I

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.