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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:43:19+00:00 2026-06-15T07:43:19+00:00

int MATCH_LENGTH = 0; int FINAL_MATCH_LENGTH = 0; int FINAL_MATCH_POS = 0; while (window.contains(next))

  • 0
int MATCH_LENGTH = 0;
int FINAL_MATCH_LENGTH = 0;
int FINAL_MATCH_POS = 0;

while (window.contains(next)) {
    int MATCH_POS = window.indexOf(next);
    boolean nextMatches = true;
    while (nextMatches = true) {
        int index = window.indexOf(next);
        index++;
        int positionOfNext = fileArray.indexOf(next);
        positionOfNext++;
        MATCH_LENGTH++;
        char afterNext = fileArray.get(positionOfNext);
        char afterNextInWindow = window.get(index);
        if (afterNext != afterNextInWindow) {
            nextMatches = false;
            if (MATCH_LENGTH > FINAL_MATCH_LENGTH) {
                FINAL_MATCH_POS = MATCH_POS;
                FINAL_MATCH_LENGTH = MATCH_LENGTH;
                MATCH_LENGTH = 0;
            }
            window.remove(window.indexOf(next));
        }
    }
}

I am running into an infinite loop here. I think it is because of the nextMatches boolean variable. However, I am not sure how that affects the program, as I have the condition for the while loop as while (window.contains(next)). However, I am removing the occurrences of next one by one, so eventually while (window.contains(next)) will have to return false and the while loop will have to break. My reasoning here might be flawed though with the remove line window.remove(window.indexOf(next));.

Or is some other part of my reasoning flawed?

  • 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-15T07:43:20+00:00Added an answer on June 15, 2026 at 7:43 am

    The problem is here while (nextMatches = true) try put instead

    while (nextMatches == true)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

private int Index(String[] match,String keyword){ int m=0; keyword=keyword+1; match[m]=match[m]+1; System.out.println(match:+match[m]); System.out.println(keyword:+keyword); System.out.println(match[m].equals(keyword)); while(!(match[m].equals()) &&
I have this function signature I have to match typedef int (*lua_CFunction) (lua_State *L);//target
String match = hello; String text = 0123456789hello0123456789; int position = getPosition(match, text); //
Does (int)myDouble ever differ from (int)Math.Truncate(myDouble) ? Is there any reason I should prefer
First code : public static int pitagoras(int a, int b) { return (int) Math.sqrt(a*a
params.max = Math.min(params.max ? params.int('max') : 2, 100) orders=OrderInfo.createCriteria().listDistinct() For pagination, we need to
From http://msdn.microsoft.com/en-us/library/system.math.pow.aspx int value = 2; for (int power = 0; power <= 32;
You can convert a negative number to positive like this: int myInt = System.Math.Abs(-5);
#include<stdio.h> #include<math.h> int main(int argc, char **argv){ // read in the command-line argument double
I have an activity with a layout contains an ImageView and TextView . ImageView

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.