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 8321703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:06:48+00:00 2026-06-08T23:06:48+00:00

I am processing lines of txt file which contains 4 boolean characteristics. I want

  • 0

I am processing lines of txt file which contains 4 boolean characteristics. I want to pass a boolean[] into a method with a reference to which line it came from (which line is defined by another variable on the line which is incremental, just not necessarily ordered).

Is there a way to create an array, of some sort, with a reference to the line variable and then the 4 booleans from that line?

If not directly, I can use 0 and 1 to represent false and true respectively eg. array[i][0] = 0; and then transfer this into a boolean in the receiving method:

boolean charone = (array[i][0] == 1) ? true : false;

Edit: The characteristics represent whether a coordinate on the line is at a maximum of the symbol described by the whole txt file.

Pattern patternx = Pattern.compile("(?<=(<))((-)*?(\\d+))(?=(,))"); 
Pattern patterny = Pattern.compile("(?<=(,))((-)*?(\\d+))(?=(>))");

for(String pin : pins){
        boolean sidemax = false;
        boolean sidemin = false;
        boolean top = false;
        boolean bottom = false;
        int i = Integer.parseInt(pin.split(" ")[1]);
        Matcher matcherx = patternx.matcher(pin);
        Matcher matchery = patterny.matcher(pin);

        while (matcherx.find()){

            String numb = matcherx.group(0);        
            int x = Integer.parseInt(numb);

            if (x >= maxx) {
                sidemax = true;
            }
            if (x <= minx){
                sidemin = true;
            }
        }
        while (matchery.find()){

            String numb = matchery.group(0);
            int y = Integer.parseInt(numb);

            if (y >= maxy) {
                top = true;
            }
            if (y <= miny) {
                bottom = true;
            } 
        }

Is there a way to carry through sidemax, sidemin, top, and bottom into another method by adding them directly to an array of every line passed in, such that the array would be 2D with the top layer being a reference and the bottom layer being 4 booleans?

  • 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-06-08T23:06:50+00:00Added an answer on June 8, 2026 at 11:06 pm

    Java is an Object Oriented Language. Create classes to represent your data:

    public class Line {
        private int lineNumber;
        private boolean value1;
        private boolean value2;
        private boolean value3;
        private boolean value4;
    
        // constructor, getters, other potential useful methods omitted
    }
    

    When reading the file, create instances of the above Line class, and pass these instances to the methods who need the 4 boolean values and the number of the line where they come from.

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

Sidebar

Related Questions

Let's say file.txt.gz has 2GB, and I want to see last 100 lines or
I have a large txt file space delimited which I split into 18 smaller
I am processing a flat file, with data in line by line format, like
I had an array which contained lines of a file that I had to
Virtually every code example out there reads a TXT file line-by-line and stores it
Essentially I have a file of lines of integers. Each line has 9 digits.
I've read in and stored a data file that I am processing into an
So I am processing a 200 mb txt file and I have to read
how do I get the read txt file into the main class? //main class
I have a log file (.txt) which has information as below: Filename1 - A3332NCDER

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.